Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

Main flows

To integrate a merchant's system with Alipay to run the Barcode payment, the merchant is required to implement functions of purchase, payment cancel, refund, order query, and settlement. These function flows are respectively explained in this chapter.

Pay flow

The following business flow shows how an Alipay payment integration works. The process involves the customer, the merchant, and Alipay.
Main flows
The following simplified flow shows the main process after calling the barcode payment interface:
Main flows
Merchants can call Payment Interface to place an order and initiate a charge request.
The following diagram shows a full purchase flow:
Main flows
Notes:

  1. To protect users from fraud, occasionally, the system might require the user to be authenticated before making a purchase. Users will be prompted to enter the payment password for various reasons, for example:
  • Alipay risk engine determines a payment looks suspicious.
  • Regulatory requirements demand an authentication step.
  1. If the payment status is unknown or if the transaction times out, call Query Interface to check the exact status.
    For more information about the parameters and error codes, see Payment Interface and Query Interface.

Cancel flow

During the payment process of a transaction, it is possible to encounter issues such as system exception or network accessibility. In such cases, merchants can reverse the transaction by using the cancel interface.
The following diagram shows the cancel flow:
Main flows
Notes:

  1. In this integration, please use the CANCEL to reverse a transaction, and the interface name is: alipay.acquire.cancel.
  1. For a transaction that has been successfully paid, the CANCEL is able to refund the transaction within the transaction day (GMT+8).
  1. Comparing with the REFUND service, if a transaction can be refunded by this CANCEL interface, the transaction fee that has been charged by Alipay will always be refunded as well.
  1. For a transaction encountered technical issues during making the payment, the CANCEL is able to roll back all the actions have been performed in the Alipay system regarding the specific transaction.
    For the full list of parameters and error code of this CANCEL service, please refer the interface API document for details. 

Refund flow

For a transaction that has been successfully paid, the customer can request the merchant for refund as long as the refund period is still valid, and the refund interface is used to complete the refund through the following business flow.

Main flows
Merchants can call the refund interface to issue the refund. The following diagram shows the refund flow:

Main flows
Notes:

  1. The refund service name is: alipay.acquire.overseas.spot.refund.
  1. The refunding service is only applicable to a transaction that has been successfully paid.
  1. The refunding of a transaction can be full or partial, i.e. the refunding amount can respectively be the same as or less than the original transaction amount that has been paid.
  1. Whether the transaction fee charged by Alipay will be refunded depends on your contract with Alipay.
  1. Comparing with the cancel interface (alipay.acquire.cancel), this service does not impose the 24-hours constraint, i.e. the merchant server can invoke this service at any time that between the moment when the transaction was paid and the time before the refund period expires.
  1. If a refund request encounters a failure, please retry for a reasonable number of times. 
    For more information about the parameters and error codes, see Refund Interface.

Query flow


You can query the status of a transaction order by using the query interface.

Main flows
The following simplified flow shows the main process after calling the query interface:

Main flows
For more information about the parameters and error codes, see The Query Interface.