Calling APIs

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

  • Issue a payment: mobile.security.pay
  • Issue a refund: forex_refund
  • Query a transaction: single_trade_query
  • Register in the AlipayHK system: alipay.overseas.secmerchant.online.maintain

How to call an API

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

Calling APIs

  1. Send a request to call an 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 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 Creating 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.