coupling, gauges and external fields

the electromagnetic field \(A_\mu\) is coupled to charges \(\jmath_\mu\) through a term \(A_\mu\jmath^\mu\) in the Lagrange density \(\mathcal{L}\). it remains invariant unter gauge transformation \(A_\mu\rightarrow A_\mu + \partial_\mu\chi\) if charge is conserved, \(\partial_\mu\jmath^\mu=0\), which is shown by integration by parts. what would happen if there are boundary terms?