The /orders endpoint lets you combine different payment methods when a shopper makes a payment. For example, a shopper can use a gift card with a balance lower than the amount of the purchase and pay the remaining amount with a credit card.
To accept partial payments with different payment methods, you must create an order, make payments, and complete the order or cancel the order.
Create an order
-
Make a POST /orders request, and specify:
Parameter Required Description amount The currency and full value of the order. reference Your unique identifier for this order. expiresAt The automatic expiry time for the order. If not provided, the order expires 24 hours after the creation date. The expiresAt
field is specified in ISO 8601. For example, 2019-01-01T14:21:00. -
The response contains the following fields that you need to make payments:
You also get an ORDER_OPENED webhook event when the order has been created.
Make a payment
-
Make a POST /payments request including:
Parameter Required Description amount The payment amount. If this is less than the remainingAmount from the /orders response, it is a partial payment. paymentMethod The payment method. order.pspReference The pspReference from the /orders response. order.orderData The orderData from the /orders response. In case of a redirect payment method such as iDEAL, you need to handle the redirect
-
The response contains an
order
object that shows the remaining amount required on the order. You also get a neworderData
value that you must include in your next payment request.
Completing an order
After making enough partial payments to pay the full order amount, you get a response with the remainingAmount.value
of 0.
A remaining amount of 0 does not indicate that the order has been completed. The order has been completed when all payments in the order have reached a final payment status, and we send an ORDER_CLOSED webhook with the success
value true.
Cancel an order
We automatically cancel an order that has not been completed and has a remaining amount greater than 0 when it reaches the expiry time.
You can also manually cancel an incomplete order. When you manually cancel an order, all the previous payments for that order are either canceled or refunded, depending on the type of payment method.
Make a /orders/cancel request including:
Parameter | Required | Description |
---|---|---|
order.pspReference | The pspReference from the /orders response. | |
order.orderData | The orderData from the most recent /orders response. |
When an order has been canceled, we send an ORDER_CLOSED webhook event with the success
value false.
Cancel a completed order
If you want to cancel an order that has the remaining amount of 0, how you can cancel the order depends on the situation:
-
If you need to manage payment balances separately, such as a partial refund, modify the partial payments individually. You can either:
- make a /cancels request to cancel payments for the partial payment.
- make a /payments/{paymentPspReference}/refunds request to refund payments for the partial payment.
-
If you need to cancel the order entirely, make a /payments/{paymentPspReference}/reversals request. The reversal request dynamically cancels or refunds the full order amount, depending on the current payment state.