Express Checkout requires the addition of an amount field to verify that the final amount matches the order total including the shipping and taxes.
As seen in the example below, you may capture payment immediately if you are using the Integrated Shipping flow and do not want to allow the total to be updated on a review page.
curl --request POST \
--url https://global-api.afterpay.com/v2/payments/capture \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"token": "YOUR_TOKEN", "amount":{"amount":"100.00", “currency”: “GBP”}}'
In addition to the required amount field, you will also need to provide some extra properties to the payload if you are using the Clearpay Checkout Widget to enable dynamic updates to the order total on a review page (e.g. selecting shipping options, increasing item quantities, applying promo codes):
isCheckoutAdjusted
: the state to indicate if changes have been made since the initial order creationitems
: the list of order items if it has changedshipping
: the shipping address if it has changedpaymentScheduleChecksum
: the latest paymentScheduleChecksum retrieved from your widget’s onChange call
If the final amount does not match the calculated amount (including shipping and taxes) or the paymentScheduleChecksum does not match the payment schedule displayed to the consumer, the request will be rejected.
The Data Payload Properties:
Attribute | Type | Description |
---|---|---|
token | String (required) | The token returned in the Create Checkout request. |
amount | Money (required) | Amount to be checked against the amount including shipping and taxes. If the amounts do not match, the request will be rejected. |
merchantReference | String | Order ID or reference this order corresponds to. |
isCheckoutAdjusted | Boolean | Whether there have been changes to the order since the initial order creation. |
paymentScheduleChecksum | String | A unique value representing the payment schedule that must be provided when there has been changes since the initial order creation. |
items | Array | An array of order items that have been updated to be provided if it has changed since the initial order creation. |
shipping | Shipping | The shipping address for this order to be provided if it has changed since the initial order creation. |