This flow completes the payment approval and starts the consumer's payment plan, but does not initiate the settlement process. This flow allows settlement of merchant funds to be deferred until order fulfilment can be confirmed.
1. Auth Flow
- Merchant calls the Get Configuration endpoint to retrieve Clearpay order limits, possibly as part of an asynchronous scheduled background process.
- Merchant stores these minimum and maximum order values server-side.
- Separately, at the checkout, Merchant uses the stored Clearpay minimum and maximum order values to determine if Clearpay should be presented as an available payment method.
- Merchant calls the Create Checkout endpoint to retrieve a Clearpay checkout token.
- Merchant uses the token in combination with the JavaScript afterpay.js to direct the Consumer through the Clearpay screenflow.
- Consumer completes the Clearpay screenflow and is returned to the Merchant website.
- If the Consumer clicks "confirm", they will be returned to the Merchant website with the
orderToken
and astatus
of "SUCCESS". - If the Consumer cancels, they will be returned to the Merchant website with the
orderToken
and astatus
of "CANCELLED".
- Merchant calls the Auth endpoint to confirm the order.
- Payment
status
("APPROVED" or "DECLINED") is only known once Auth has been completed. - If the payment was approved by Clearpay, Merchant stores the
id
of the Payment, and theexpires
timestamp of the "AUTH_APPROVED" Payment Event, and presents the Consumer with an order confirmation/receipt page. - If the payment was declined by Clearpay (e.g. the Consumer’s card details are entered incorrectly), Merchant presents an appropriate message to the Consumer at the checkout.
Beware
Authorisation expires after 13 days and then the transaction is automatically voided. Voided transactions are frozen and cannot be reopened or changed in any way. In this case your only option is to use the v2/checkouts endpoint to create a new order.
2. Capture Flow
This part of the flow applies only to orders that received a status
of "APPROVED" during the Auth Flow.
The below scenarios occur after the Consumer has seen their order confirmation page and potentially left the Merchant website.
Note
In all cases, the minimum amount that can be captured is £1.00. Capture requests less than £1.00 will be rejected.
Scenario 1: Merchant can completely fulfil the order
(Capture)
- As soon as it is determined that the entire order will be fulfilled, Merchant calls the Capture Payment endpoint for the entire amount.
- In this case, the capture amount will match both the
originalAmount
andopenToCaptureAmount
of the Payment object, as returned in the Auth response.
Scenario 2: Merchant can partially fulfil the order
(Capture + Void)
- As soon as it is determined that only part of the order will be fulfilled, Merchant calls the Capture Payment endpoint with the combined total amount for all items that will be fulfilled.
- Merchant calls the Void endpoint to finalise the order, refunding the
openToCapture
amount to the consumer and reducing theopenToCapture
amount to zero.- When the auth expiration date/time is reached, if the order still has a
paymentState
of "AUTH_APPROVED" or "PARTIALLY_CAPTURED", Void will be triggered automatically.
- When the auth expiration date/time is reached, if the order still has a
Scenario 3: Merchant fulfils the order incrementally and captures a payment at each fulfilment
( Capture + [ Captures + Voids ])
- As soon as a shipment is dispatched, Merchant calls the Capture Payment endpoint for the combined value of all applicable items.
- This can occur multiple times.
- Any capture request that exceeds the 'openToCapture' amount will fail.
- As soon as a shipment is determined it cannot be dispatched, Merchant calls the Void endpoint for the combined value of all applicable items.
- This can occur multiple times.
- Any void request for an amount exceeding the 'openToCapture' amount will fail.
- Once the entire 'openToCapture' reaches zero, no further Captures or Voids will be valid.
- When the auth expiration date/time is reached, if the order still has a
paymentState
of "AUTH_APPROVED" or "PARTIALLY_CAPTURED", Void will be triggered automatically.
Scenario 4: Merchant cannot completely or partially fulfil the order
(Void)
- As soon as it is determined that no fulfilment can occur, Merchant calls the Void endpoint to finalise the order, refunding the
openToCapture
amount to the consumer and reducing theopenToCapture
amount to zero.- When the auth expiration date/time is reached, if the order still has a
paymentState
of "AUTH_APPROVED", Void will be triggered automatically. - Please be mindful that even though an approved auth will expire and void automatically, consumers began their payment plan at the time of auth approval.
- When the auth expiration date/time is reached, if the order still has a
Warning
When the auth expiration date/time is reached, the auth will be automatically voided.