alipay.acquire.query
Call this interface to query transaction status and other details.
Request
Service address
Environment | HTTPS request URL |
Production environment | |
Test environment |
Request parameters
Parameter | Description |
Basic parameters | |
service String | Service Name
|
partner String(16) | Partner ID that is composed of 16 digits beginning with 2088.
|
_input_charset String | The charset with which the request data is encoded. UTF-8 is supported.
|
sign_type String | Sign type. DSA, RSA, and MD5 are supported. Use uppercase.
|
sign String | Sign value
|
alipay_ca_request | Signature type.
If this is null, the default value shall be 2.
|
Business parameters | |
out_trade_no String(64) | Unique order No. in Alipay’s merchant’s website
|
trade_no | The trade serial number of the trade in Alipay system.16 bits at least and 64 bits at most. If out_trade_no and trade_no are transmitted at the same time, trade_no shall govern.
|
Response
Parameter | Description |
Basic parameters | |
is_success | Request succeeds or not. Successful request does not mean the business is accepted and processed successfully.
|
sign_type String | Sign type. DSA, RSA, and MD5 are supported. Use uppercase.
|
sign | Sign value
|
error |
|
Business parameter | |
result_code | Response code of refund processing result.
|
trade_no | Trade number of the trade in Alipay system16 bits at least and 64 bits at most
|
out_trade_no | Unique order ID in order system in corresponding merchant’s website other than Alipay trade number.Uniqueness of this parameter in merchant’s website shall be guaranteed. This is a parameter transmitted upon corresponding request, which shall be returned in its original shape.
|
buyer_user_id | Unique Alipay user ID corresponding to Buyer’s Alipay logon ID.16 numbers beginning with 2088
|
buyer_logon_id | Buyer’s Alipay logon ID, may be email or phone number.
|
partner | Unique Alipay user number corresponding to authorized Alipay account number. Composed of 16 numbers beginning with 2088.
|
trade_status | Current trade status.
|
detail_error_code | Give cause description to the response code returned. Please refer to Business errors. If the response code of result_code is SUCCESS, this parameter shall not be returned.
|
detail_error_des | Give literal statement as to the detailed error code. If the response code of result_code is S UCCESS, this parameter shall not be returned.
|
fund_bill_list | Information about the payment channel used in this trade shall be in the format of xml and may include the child node (<TradeFundBill>) of muti-channel information. Please refer to fund_bill_list. If the list of payment documents is required to be returned, partner and Alipay shall reach an agreement on return upon signing contract; the system gives tacit consent to not return this parameter.
|
total_fee | Order amount paid in this trade, unit: RMB (Yuan).
|
total_price | The pricing in foreign currency. If the transaction is priced in RMB, this parameter is null
|
currency | The currency used for settlement.
|
trans_currency | Pricing currency of the transaction
|
exchange_rate | Exchange rate of foreign currency and CNY (RMB).
|
send_pay_date | The time of transferring payment to seller’s account, format: yyyy-MM-dd HH:mm:ss.
|
extend_info_list | The extend information list of the trade, XML format, can include multiple extension child node<ExtendInfo>. The Child node please refer to extend_info_list.
|
fund_bill_list
Parameter | Description |
fund_channel | Payment channel, please refer to Payment Channels.
|
amount | Amount paid through the designated payment channel, Unit: Yuan
|
extend_info_list
Parameter | Description |
Key | Now only support:
|
Value | The value of extend information
|
Error codes
Business response codes
Error code | Description |
ORDER_FAIL | The ordering fails. |
ORDER_SUCCESS_PAY_SUCCESS | Both the ordering and the payment succeed. |
ORDER_SUCCESS_PAY_FAIL | The ordering succeeds, but the payment fails. |
ORDER_SUCCESS_PAY_INPROCESS | The ordering succeeds and the payment is under processing. |
UNKNOWN | The processing result is unknown. |
Business errors
Error code | Description |
TRADE_SETTLE_ERROR | Verification of royalty distribution information fails. |
TRADE_BUYER_NOT_MATCH | The buyer is unmatched. |
CONTEXT_INCONSISTENT | Trade information has been altered. |
TRADE_HAS_SUCCESS | The payment of trade has been made. |
TRADE_HAS_CLOSE | The trade has been closed. |
REASON_ILLEGAL_STATUS | The trade status is illegal. |
EXIST_FORBIDDEN_WORD | Banned words are included in order information. |
PARTNER_ERROR | Partner information is incorrect. |
ACCESS_FORBIDDEN | Has no right to use the product. |
SELLER_NOT_EXIST | The seller does not exist. |
BUYER_NOT_EXIST | The buyer does not exist. |
BUYER_ENABLE_STATUS_FORBID | The buyer status is illegal and the trade cannot be continued. |
BUYER_SELLER_EQUAL | The seller and the buyer have the same account and the trade cannot be conducted. |
INVALID_PARAMETER | Parameter is invalid. |
UN_SUPPORT_BIZ_TYPE | Unsupported business type |
INVALID_RECEIVE_ACCOUNT | The seller is not included in receiving account list. |
BUYER_PAYMENT_AMOUNT_DAY_LIMIT_ERROR | The buyer’s payment on the payment day exceeds limit. |
ERROR_BUYER_CERTIFY_LEVEL_LIMIT | The buyer fails to pass verification conducted by People’s Bank of China. |
ERROR_SELLER_CERTIFY_LEVEL_LIMIT | The seller fails to pass verification conducted by People’s Bank of China. |
CLIENT_VERSION_NOT_MATCH | The wallet version is obsolete. Please update it to the latest version before use. |
AUTH_NO_ERROR | Authorization number is wrong for which the possible reasons include:
The receiver owning the authorization number is not the same as the request receiver. |
BUYER_BANKCARD_BALANCE_NOT_ENOUGH | Buyer bankcard balance is not enough. |
PULL_MOBILE_CASHIER_FAIL | Fail to pull mobile cashier. |
PAYMENT_FAIL | Fail to payment. |
MOBILE_PAYMENT_SWITCH_OFF | Wireless switch is closed, unable to pay. |
SOUNDWAVE_PARSER_FAIL | Soundwave/barcode parse fail. |
ERROR_BALANCE_PAYMENT_DISABLE | Balance payment function is closed. |
ORDER_UN_SUPPORT_PROMOTE | This order does not support the specified discount. |
BUYER_BALANCE_NOT_ENOUGH | Buyer balance is not enough. |
SELLER_BEEN_BLOCKED | Seller account is blocked. |
BEYOND_PAY_RESTRICTION | Beyond pay restriction. |
BEYOND_PER_RECEIPT_RESTRICTION | The seller amount receivable more than month restriction. |
TOTAL_FEE_EXCEED | Order amount exceed the limit. |
VOUNCHER_NOT_EXIST | Merchant coupons does not exist. |
BUYER_PAYMENT_COUNT_DAY_LIMIT_ERROR | Buyer payment count of one day exceed the limit. |
BUYER_PAYMENT_COUNT_MONTH_LIMIT_ERROR | Buyer payment count of one month exceed the limit. |
CLIENT_NOT_ONLINE | User client is not online, so that unable pull mobile cashier. |
TRADE_STATUS_ERROR | Trade status error. |
BUYER_PAYMENT_AMOUNT_MONTH_LIMIT_ERROR | Buyer payment amount of one month exceed the limit. |
PRODUCT_AMOUNT_LIMIT_ERROR | Product amount exceed the limit. |
PAYMENT_REQUEST_HAS_RISK | Payment has risk. |
DUPLICATE_PAY_CURRENCY_NOT_EQUAL | Duplicate payment currency is inconsistent with the first payment currency. |
AGREEMENT_NOT_EXIST | Agreement information is not exist. |
AGREEMENT_INVALID | Agreement is invalid. |
AGREEMENT_ERROR | Abnormal agreement information. |
NO_PAYMENT_INSTRUMENTS_AVAILABLE | There is not available payment instruments. |
USER_LOGONID_DUP | The user’s logonid is duplicated with other people (special case when a user is using cell phone number as logon id) |
EXCHANGE_AMOUNT_OR_CURRENCY_ERROR | The exchange amount or currency is error |
Access errors
Error code | Description |
ILLEGAL_SIGN | Illegal signature. |
ILLEGAL_DYN_MD5_KEY | Dynamic key information is incorrect. |
ILLEGAL_ENCRYPT | Encryption is incorrect. |
ILLEGAL_ARGUMENT | Parameter is incorrect. |
ILLEGAL_SERVICE | Service parameter is incorrect. |
ILLEGAL_USER | User ID is incorrect. |
ILLEGAL_PARTNER | Partner ID is incorrect. |
ILLEGAL_EXTERFACE | Interface configuration is incorrect. |
ILLEGAL_PARTNER_EXTERFACE | Partner’s interface information is incorrect. |
ILLEGAL_SECURITY_PROFILE | Matching private key configuration has not been found. |
ILLEGAL_AGENT | Agency ID is incorrect. |
ILLEGAL_SIGN_TYPE | The signature type is incorrect. |
ILLEGAL_CHARSET | The character set is illegal. |
HAS_NO_PRIVILEGE | Has no right to visit. |
INVALID_CHARACTER_SET | The character set is invalid. |
System errors
Error code | Description |
SYSTEM_ERROR | Alipay system failed to process the request due to temporary internal glitch. |
SESSION_TIMEOUT | Session timeout |
ILLEGAL_TARGET_SERVICE | Wrong target_service |
ILLEGAL_ACCESS_SWITCH_SYSTEM | Merchant is not allowed to visit system of this type. |
EXTERFACE_IS_CLOSED | The interface has been closed. |
Trade status
Code | Description |
WAIT_BUYER_PAY | The trade has been established and is waiting for the buyer to make payment. |
TRADE_CLOSED |
|
TRADE_SUCCESS | The trade succeeds and is operable, such as multi-level royalty distribution, refund, etc. |
TRADE_PENDING | Wait for the seller to collect payment (if the seller’s account is frozen after the buyer has made the payment). |
TRADE_FINISHED | The trade succeeds and finishes and is not operable. |
Payment channel
Code | Payment channel |
00 | Alipay Coupon |
10 | Alipay balance |
60 | Alipay pre-deposit card |
30 | Points |
70 | Credit payment |
40 | Discount coupon |
80 | Prepaid card |
90 | Credit payment (consumption credit) |
100 | Special Alipay account for financial management |
101 | Merchant’s shop card |
102 | Merchant’s discount coupon |
103 | Blank note |
104 | Red envelope |
Samples
Request sample
https://mapi.alipay.com/gateway.do?sign=31a008138e2f26a6414119984553e538&trade_no=2013112611001004680073956707&_input_charset=UTF-8&sign_type=MD5&service=alipay.acquire.query&partner=2088101125328850&alipay_ca_request=2&out_trade_no=HZ0120131127001
Response sample
Example of Payment Documents Information:
<fund_bill_list>
<TradeFundBill>
<amount>70.00</amount>
<fund_channel>10</fund_channel>
</TradeFundBill>
<TradeFundBill>
<amount>20.00</amount>
<fund_channel>00</fund_channel>
</TradeFundBill>
<TradeFundBill>
<amount>10.00</amount>
<fund_channel>30</fund_channel>
</TradeFundBill>
</fund_bill_list>
The example of returned extend information:
<extend_info_list>
<ExtendInfo>
<key>SHOP_ID</key>
<value>BJ_ZZ_001</value>
</ExtendInfo>
<ExtendInfo>
<key>TERMINAL_ID</key>
<value>12345</value>
</ExtendInfo>
</extend_info_list>
Response sample
Business is accepted and processed normally, and query is conducted successfully:
<?xml version="1.0" encoding="utf-8"?>
<alipay>
<is_success>T</is_success>
<request>
<param name="sign">c7d17d40111b8264975a6bfba77962cb</param>
<param name="_input_charset">UTF-8</param>
<param name="sign_type">MD5</param>
<param name="service">alipay.acquire.query</param>
<param name="partner">2088101126765726</param>
<param name="out_trade_no">3406822113320232</param>
<param name="alipay_ca_request">2</param>
</request>
<response>
<alipay>
<result_code>SUCCESS</result_code>
<buyer_logon_id>ali***@alitest.com</buyer_logon_id>
<buyer_user_id>2088102114647394</buyer_user_id>
<out_trade_no>3406822113320232</out_trade_no>
<partner>2088101126765726</partner>
<trade_no>2013111511001004390000105126</trade_no>
<trade_status>TRADE_CLOSED</trade_status>
</alipay>
</response>
<sign>630c9331f0946bde8e164564d1f7aeeb</sign>
<sign_type>MD5</sign_type>
</alipay>
Request succeeds, business processing fails:
<?xml version="1.0" encoding="utf-8"?>
<alipay>
<is_success>T</is_success>
<request>
<param name="sign">c7d17d40111b8264975a6bfba77962cb</param>
<param name="_input_charset">UTF-8</param>
<param name="sign_type">MD5</param>
<param name="service">alipay.acquire.query</param>
<param name="partner">2088101126765726</param>
<param name="out_trade_no">3406822113320232</param>
<param name="alipay_ca_request">2</param>
</request>
<response>
</alipay>
<result_code>FAIL</result_code>
<detail_error_code>TRADE_NOT_EXIST</detail_error_code>
<detail_error_des>trade does not exist</detail_error_des>
<alipay>
<response>
<sign>d24b14dad80461060ad7ffb8a5993a13</sign>
<sign_type>MD5</sign_type>
</alipay>
Output when Request fails or the data accessed is wrong:
<?xml version="1.0" encoding="utf-8"?>
<alipay>
<is_success>F</is_success>
<error>ILLEGAL_SIGN</error>
</alipay>