You can send an HTTP/HTTPS request to get a specific Alipay-provided service:
- To issue a payment: create_forex_trade
- To issue a refund: forex_refund
- To query a transaction: single_trade_query
- To register in the AlipayHK system: alipay.overseas.secmerchant.online.maintain
How to call an API?
By sending an HTTP/HTTPS request, you can call one of the Alipay-provided APIs. The following graphic shows the process of calling an API and the corresponding results.
- Generate a request URL and send an HTTP/HTTPS request to the Alipay server. The Alipay server verifies request parameters and then redirect you to the buyer’s login page. For more information about the request URL, see Creating the Request URL.
- After a payment is made, Alipay returns an asynchronous notification, or a synchronous notification, or both. For more information about the returned notifications, 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.
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 synchronous and asynchronous notifications might be returned. 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 actions according to the trade status.