Afterpay Processing
Afterpay is offered as an alternate payment method for completing an online purchase. Afterpay works by allowing the shopper to pay for their purchase over four equal installments interest-free and with no additional cost if paid on time. The first installment is collected on the day of purchase with each installment occurring after two weeks from the previous. Afterpay is offered through integration with Radial payment service, with no direct calls to Afterpay.
Afterpay Full Flow Diagram
The following flow diagram shows the series of calls and events for a typical checkout transaction involving Afterpay payment
Afterpay Checkout Flow
This Afterpay checkout flow example covers the system interactions that occur between a web store, an Order Management System (OMS), the Radial Payments API, and the Afterpay login page.
- Before Afterpay can be presented to the shopper, the web store must first confirm the total order amount by calling Afterpay Get Configuration. The order total amount must be within the range of the selected payment type, otherwise the payment will be rejected by Afterpay.
- The configuration of payment ranges is subject to periodical updates from Afterpay, indicated by the expiration date/time in the AfterpayConfiguration element from Get Configuration reply. As such, web stores are expected to cache the configuration until expiration so as to not call Get Configuration for each order.
- When the customer submits their order, the web store will make the Afterpay Initialize Payment Authorization request.
This is the first API call of the Afterpay checkout flow and is used to initiate the Afterpay authorization process. The request includes the order details, and the RedirectUrl (used by Afterpay to redirect the user after payment is confirmed on Afterpay login page). The Initialize Payment Authorization reply returns a unique PaymentId as a token to be referenced in the next step (typically expires in 30 to 50 minutes).
If Initialize Payment Authorization call times out, it's recommended to re-attempt the request with the same OrderId until either the call is successful with a PaymentId returned, or a set number of maximum retries (for exmaple, three times) is reached after which the user may be presented with alternate payment options.
- Once a PaymentId is returned, the web store will use the Payment Id to call afterpay.js, which redirects the customer to the Afterpay login page.
Once on the Afterpay login page the user will create an account or log into an existing one. There the user confirms their payment before redirected back to the web store (using the RedirectUrl from the Initialize Payment Authorization request).
Alternately, tif the the user cancels the payment from the Afterpay login page they will be redirected back to the web store (using the CancelUrl in the Initialize Payment Authorization request).
- After successful redirecting the user back to the web store, the web store submits a Afterpay Get Payment Authorization request, using the PaymentId from the first step.
- The Get Payment Authorization reply will return a ResponseCode to confirm the status of the payment.
- If the value is APPROVED, see Approved Processing below.
- If the value is DECLINED, see Declined Processing below.
- If the value is ERROR, see Error Processing below.
- If the value is TIMEOUT, see Timeout Processing below.
Approved Processing
If ResponseCode value is APPROVED:
- The web store accepts the order and sends it to OMS for processing.
- At time of shipment, the OMS submits a PaymentSettlement request to capture the funds.
Declined Processing
If ResponseCode value is DECLINED:
- The web store refuses the order and shows the customer alternate payment options.
- No further action is required.
Error Processing
If ResponseCode value is ERROR:
- The web store may choose to correct the errors based on the error response, such as those caused by invalid request and try again. Or
- The web store shows the customer alternate payment options.
Timeout Processing
If ResponseCode value is TIMEOUT:
- end the GetPaymentAuthorization request for a set number of times, for example, three times.
- On approval follow the steps above for Approved Processing.
- Otherwise, continue the process according to the ResponseCode value:
- APPROVED: see Approved Processing above.
- DECLINED: see Declined Processing above.
- ERROR: see Error Processing above.
- TIMEOUT: if web store chooses to not accept Afterpay payment for the order, refund may be issued manually to void the order in the cases when payment goes through on Afterpay side.
Refund Processing
In the case of any refunds or cancellations, the OMS will submit a PaymentSettlement refund request to Afterpay.
Afterpay Processing Notes
Some helpful things to remember
- The web store should verify that the AmountAuthorized from GetPaymentAuthorization reply covers the order total amount before confirming the order.
- Once a successful Afterpay payment is received on the GetPaymentAuthorization call, the process starts to collect the funds from the customer's account and can only be released/refunded if OMS submits a PaymentSettlement refund request with TenderType AF. This means order or cancels will need to be processed as a refund.