Alipay Processing
Alipay is available as an additional payment method when making USD payments towards a purchase. The Alipay service allows people to send money without sharing financial information, and it offers the flexibility to pay using account balances, bank accounts, credit cards, or other sources. Alipay integration is handled through integration with Radial's payment service.
Alipay Full Lifecycle Flow Diagram
The following flow diagram shows the series of calls and events for a typical transaction involving an Alipay payment
Alipay Checkout Flow
This Alipay Express Checkout flow example covers the system interactions that occur between a webstore, the Order Management System (OMS), the Payments API, and Alipay
- When the customer is ready to check out, the webstore sends a AlipayGetPayment request.
It is the first API call of the Alipay checkout flow. It is used to initiate the Alipay authorization process. The request includes the order details and the ReturnUrl that is used by Alipay to redirect the user after payment is confirmed on Alipay's cashier page. The AlipayGetPayment response returns a RequestUrl used in the next step. This Alipay URL, uniquely generated for each transaction, is used by the webstore to redirect the user to perform authentication and confirm the order on Alipay's website.
- The webstore redirects the customer to the RequestUrl in the AlipayGetPayment response.
The user authenticates on this Alipay cashier page and confirms the payment for the order. After successful confirmation, the user is redirected back to the webstore's ReturnUrl
- The webstore then submits a AlipayPaymentStatus request, using the OrderId from the Step 1.
The AlipayPaymentStatus response returns a Status element to determine the status of the payment. Continue the process according to the Status value:
- If the value is Success, see Success Processing, below.
- If the value is Failure, see Failure Processing, below.
- If the value is Timeout, see Timeout Processing, below.
Success Processing
If the Status value is Success, the following steps conclude the Alipay Checkout flow:
- The webstore accepts the Order and sends it to OMS for processing.
- OMS submits a PaymentSettlement request to capture the funds.
- After final line item shipment (when no further capture is necessary), the OMS sends one final PaymentSettlement request with FinalDebit flag set to true. This request finalizes the funds capture, and no more capture settlement requests are possible afterwards.
- The final request triggers a PaymentSettlement refund request to Alipay if there are any funds that are still on hold from the transaction. This request releases the hold on the account created by the checkout flow.
Failure Processing
If the Status value is Failure, the following steps conclude the Alipay Checkout flow:
- The webstore refuses the order and show the customer alternate payment options.
- The webstore submits a PaymentSettlement refund request to release the hold on the order created by the previous Alipay calls.
Timeout/Pending Processing
If the Status value is TIMEOUT or PENDING, in the Alipay Checkout flow for AlipayPaymentStatus request, continue with the folowing steps:
- The webstore is recommended to do one of the following:
- If the maximum number of AlipayPaymentStatus retries has been reached, the webstore submits a PaymentSettlement refund request to release the hold of funds for the Order.
- If additional retries are available, the webstore retries the AlipayPaymentStatus call.
- The webstore accepts the order and prompts the OMS to try again to make another AlipayPaymentStatus call before the order is shipped.
- Continue the process according to the Status value:
- PAID: see Success Processing, above.
- REJECTED: OMS submits a PaymentSettlement refund request to release any possible hold on the account.
- TIMEOUT/PENDING: OMS retries the AlipayPaymentStatus call, or submits PaymentSettlement refund request to void the Order if maximum number retries is reached.
If there is a timeout for AlipayGetPayment request (the first step to get a unique Alipay redirect URL), continue with the folowing steps:
- The webstore is recommended to reattempt the AlipayGetPayment request with the same OrderId and RequestId until the set number of maximum retries is reached. After this, the user may be presented with alternate payment options.
Alipay Processing Notes
A successful Alipay payment on the cashier page places an immediate transfer of funds from the customer's account and can be released/refunded only if the OMS submits a PaymentSettlement refund request with TenderType=AL.
- If AlipayPaymentStatus call returns a Success, the OMS submits PaymentSettlement request to capture the funds. With the final line item shipment (i.e. no further capture necessary), OMS sends one final PaymentSettlement request with FinalDebit flag set to true, which finalizes the funds capture (no more capture settlement requests are possible afterwards). This also triggers a PaymentSettlement refund request with TenderType=AL for any remaining amount to refund to the account.
- If an AlipayGetPayment request is made with the same OrderId and RequestId then the response ReturnURL will always be the same. If the intention of the webstore is to create a new transaction (for example, when any order level changes happened before redirecting to Alipay etc) then a new RequestId has to be sent in the AlipayGetPaymentRequest always, so unique ReturnURL for that transaction can be created.
- In the event of the following scenarios in the Alipay checkout flow, a new AlipayGetPayment with a new RequestId is required to be sent, so a new transaction can be created and a corresponding unique Alipay redirect URL is generated in the response.