Pay for Orders
When you want an application to pay for an order using a single payment, use the Payments API (CreatePayment endpoint). Note the following:
CreatePaymentrequest must include an order ID.
- The payment amount must match the order total (the
CreatePayment example charges the specified payment source $2 to pay for the specified order:
For more information about how to use payments, see Take Payments.
Sometimes applications might want to apply multiple payments to an order. For example, first pay a portion using a gift card and then apply a credit card for the rest of the amount. To apply multiple payments to an order, applications must use the Orders API (
PayOrder endpoint). These payments must be previously authorized (see Delayed Capture of a Card Payment). For example, to pay for an order using three payments, do the following:
CreatePaymentthree times. In each request, you specify the order ID and set the
false(to obtain only authorization).
PayOrderby specifying the authorized payment IDs. The endpoint captures the previously authorized payments. The endpoint also sets the order state to
COMPLETED, provided that:
The sum of all these payments is equal to the order total (
The order doesn't include fulfillment.
PayOrder example pays for an order by specifying payment IDs of previously authorized payments:
Suppose you create an order for $20 and apply a $20 discount. You then need to make a $0 payment to set the order
COMPLETED. Applications can use either the Payments API or Orders API.
Using the Payments API - Use the
CreatePaymentendpoint to record a $0
EXTERNALpayment for an order.
Using the Orders API - Use the
PayOrderendpoint to apply a $0 payment. The request doesn't include any payment IDs.