Apply payments to an invoice: streamlined method
Learn how to apply payments to an invoice using the streamlined method.
This method is supported in version 22.0+ of API, and can be used when applying a payment to single invoice.
To create and apply an electronic payment to an invoice:
Determine the invoice that you want to apply payment to. Execute the following query to determine the invoice to which you want to apply a payment:
The following is an example of a SOAP call envelope payload for this query:
Create a new payment.
Set the following fields to create a new payment:
- Specify the
AccountId. - Specify
Amount, which indicates the amount of the payment. If Invoice Settlement is enabled, this field is required. - Specify the
InvoiceId, which is the single Invoice to which apply the payment. - Specify
AppliedInvoiceAmount, the amount of the payment that should be applied to the invoice. This can be NULL ifAppliedCreditBalanceAmountis not NULL. - Specify
AppliedCreditBalanceAmount, the amount of the payment that should be added to the account credit balance. Use this if you are creating a payment that pays an invoice and also applies credit, which is useful for when a customer overpays. This can be NULL if AppliedInvoiceAmount is not NULL. - Set the
EffectiveDateto the desired dateTime when this payment was made. - Specify the
PaymentMethodId. This should equal to either the actual PaymentMethod ID for the account or the placeholder PaymentMethod ID for cash, check, or other payment method. - Set the
Typefor this payment:External(cash, check, other) orElectronic(credit card, PayPal, or ACH). - Set the
StatustoProcessed.
The following is an example of a SOAP call envelope payload that will create the payment, create the InvoicePayment, and if the payment is electronic, process it through the gateway.