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

Calling APIs

You can send a request to call one of the following Alipay APIs. After one successful trade, the notifications will be sent to you by Alipay. For more details about notifications, see Processing Notifications.

How to call an Alipay API

You can send a request to call one of the following Alipay APIs. The following graphic shows the process of calling an API and the possible reactions after the calling.

callapi1.jpg

  1. Send a request to call an Alipay API. Alipay makes a verification for the request parameters and then redirect you to the buyer's login page.
    To send a request to call Alipay APIs, you need to generate a request URL to pass the parameters and other data, and this URL can be used for page redirection. For more information, see Signing the Request and Create the Request URL.
  2. After the user makes a payment, Alipay returns an asynchronous notification, or a synchronous notification, or both. For more information about the type of the returned notification, see Processing notifications.
  3. If you cannot receive the asynchronous notification for an internet reason, you can call the Alipay transaction query API single_trade_query to get the payment and transaction data.

Note:
You can use the Alipay transaction query API directly to obtain the transaction data, no need to rely on the asynchronous notification.

  1. After one successful trade, both sync and async notify might be sent to you. It is recommended that you verify the asynchronous notification first. The process of verifying the synchronous notification is optional. For more information about verifying the notifications, see Processing notifications.
  2. If the signature verification is passed, check the content of the notification. Ensure the consistency between the content of the notification and the original request. And determine your further action for process according to the trade status.