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.
- Issue a payment: Create_forex_trade_wap
- Issue a refund: Forex_refund
- Query a transaction: Single_trade_query
- Get the exchange rate: Forex_rate_file
- Register in the Alipay system: alipay.overseas.secmerchant.online.maintain
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.
- 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. - 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.
- 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.
- 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.
- 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.