alipay.fund.auth.order.voucher.create
Call the alipay.fund.auth.order.voucher.create interface to initiate a website funds pre-authorization (pre-auth) order and freeze the funds.
Service address
Environment | HTTPS request URL |
Production environment | |
Test environment |
Request parameters
Parameter | Type |
Basic parameter | |
app_id String (32) | The unique ID that is assigned by Alipay to identify an application. Example: |
method String (128) | Interface name Example: |
format String (40) | Only JSON is supported. Example: |
charset String (10) | The charset with which the request data is encoded. GBK and UTF-8 are supported. Example: |
sign_type String (10) | Signature type. RSA and RSA2 are supported. Use uppercase. Example: |
sign String (344) | Signature value |
timestamp String (19) | The time when the merchant server sends the request. The format is yyyy-MM-dd HH:mm:ss. Example: |
version String (3) | The API version. The value is fixed as 1.0. Example: |
notify_url String (256) | The URL for receiving asynchronous notifications after the pre-auth is completed. Example: |
app_auth_token String (40) | To query authorization information. Example: Note: After a merchant authorizes an ISV to use certain APIs, Alipay will assign an app_auth_token to the ISV. The ISV can use this interface to query the authorization information such as the authorizer and authorized APIs corresponding to the app_auth_token. For more details, see Overview of the app authorization (in Mandarin). |
biz_content String | Collection of request parameters. The maximum length is not limited. Except for common parameters, all other request parameters must be passed in to this parameter. |
Business parameter | |
out_order_no String (64) | The transaction number of funds pre-auth assigned by merchant. The number must be unique on the merchant end. Example: |
out_request_no String (64) | The serial number of a merchant's funds pre-auth request. The number must be unique on the merchant end. Example: |
product_code String (32) | The product code of the Alipay product that you use. The value for this field is Example: |
order_title String(100) | Transaction title Example: |
amount Price (11) | Frozen amount Example: |
pay_timeout String (5) | The period before the customer confirms the authorization. The value of this field is 15m by default. The value of this field ranges from 1m to 15d. Note: The following abbreviations are used to present units of time:
Example: |
payee_logon_id String (100) | The payee's Alipay login ID, email, or phone number are supported.
Note: If both payee_logon_id and payee_user_id are passed, use payee_user_id. If the merchant selects credit pay as pay method, then payee_logon_id and payee_user_id cannot both be null. Example: |
payee_user_id String (32) | The payee's unique Alipay user ID. The user ID is composed of 16 digits and begins with 2088.
Note: If payee_user_id is not null, the system will check if the payee of the transaction matches with payee_user_id. If the merchant selects credit pay as pay method, then payee_logon_id and payee_user_id cannot both be null. Example: |
trans_currency String (8) | The pricing currency. Use uppercase. Refer to Supported Currencies for more information. Example: |
settle_currency String (8) | Merchant settlement currency. Use uppercase. Example: |
extra_param
Parameter | Description |
secondaryMerchantId String | The unique ID assigned by the partner to identify a secondary merchant. Example: |
category String | The type of in-store funds pre-auth. Example: |
outStoreCode String | Merchant store number Example: |
outStoreAlias String | Alias of a merchant's store. |
Response
Synchronous response
Parameter | Description |
Basic parameter | |
code String (16) | The gateway return code, which indicates whether the request is accepted by Alipay gateway. Example: |
msg String (32) | Description of the gateway return code Example: |
sub_code String (16) | Processing result of the request Example: |
sub_msg String (64) | Description of the processing result of the request |
sign String (344) | The sign value. See Signature for details. |
Business parameter | |
out_order_no String (64) | The transaction number of funds pre-auth assigned by merchant. Example: |
out_request_no String (64) | The serial number of funds operation request assigned by merchant. Example: |
code_type String(20) | The code type, including barCode and qrCode. Only qrCode is supported now. Example: |
code_value String(200) | The QR code string generated for the request creation. The merchant can use the QR code generator with the string to create the QR code. Example: |
code_url String(200) | The URL address of the generated QR code with Alipay's logo is http://mobilecodec.alipay.com/show.htm?code=aeparsv2dknkqf3018556a The merchant may add picSize at the end to assign the picture's size. For example, a 1280p picture's URL is http://mobilecodec.alipay.com/show.htm?code=aeparsv2dknkqf3018556a&picSize=1280 Supported resolutions include: 256, 227, 270, 344, 430, 512, 570, 860, 1280, and 1546. Example: |
Asynchronous response
Parameter | Description |
auth_no String (64) | The transaction number of funds pre-auth assigned by Alipay, which is composed of 28 digits. Example: |
operation_id String (64) | The serial number of funds operation assigned by Alipay. Example: |
out_order_no String (64) | The transaction number of funds pre-auth assigned by merchant. Example: |
out_request_no String (64) | The serial number of funds operation request assigned by merchant. Example: |
operation_type String (20) | Funds operation type. Possible values include:
Example: |
amount Price (11) | The total amount of funds frozen in the transaction currency, rounded to 2 decimal places. Example: |
status String (20) | Status of the funds pre-auth. Possible values are:
Example: |
payer_user_id String (32) | Payer's Alipay user ID Example: |
payer_logon_id String (100) | The payer's Alipay login ID, email, or phone number are supported. Example: |
payee_user_id String (32) | Payee's unique Alipay user ID Example: |
payee_logon_id String (100) | Payee's Alipay login ID, email, or phone number are supported. Example: |
gmt_trans Date | The time when the funds pre-auth changed. The format is yyyy-mm-dd hh:mm:ss. Use GMT+8. Example: |
gmt_create Date | The time when the funds pre-auth succeed. The format is yyyy-mm-dd hh:mm:ss. Example: |
pre_auth_type String (32) | The pre-auth type. Only With this parameter, merchants can determine the type of pre-auth. Return value being Example: |
total_freeze_amount String (11) | The total frozen amount. The unit is the transaction currency used when the funds were frozen. Example: |
total_unfreeze_amount String (11) | The total unfrozen amount. The unit is the transaction currency used when the funds were frozen. Example: |
total_pay_amount String (11) | The total paid amount. The unit is the transaction currency used when the funds were frozen. Example: |
rest_amount String (11) | The total paid amount. The unit is the transaction currency used when the funds were frozen. Example: |
credit_amount String (11) | The credit amount. The currency is RMB. Example: |
fund_amount String (11) | The balance amount. The currency is RMB. Example: |
total_freeze_credit_amount String (11) | The total frozen credit amount. The currency is RMB. Example: |
Total_freeze_fund_amount String (11) | The total frozen balance amount. The currency is RMB. Example: |
total_unfreeze_credit_amount String (11) | The total unfrozen credit amount. The currency is RMB. Example: |
total_unfreeze_fund_amount String (11) | The total unfrozen balance amount. The currency is RMB. Example: |
total_pay_credit_amount String (11) | The total paid credit amount. The currency is RMB. Example: |
total_pay_fund_amount String (11) | The total paid balance amount. The currency is RMB. Example: |
rest_credit_amount String (11) | The rest credit amount. The currency is RMB. Example: |
rest_fund_amount String (11) | The rest balance amount. The currency is RMB. Example: |
trans_currency String (8) | The pricing currency. Use uppercase. Example: |
Notification trigger condition
Trigger condition name | Description | Note |
fund_auth_freeze | Pre-auth fund is frozen successfully | true (triggers notification) |
fund_auth_freeze.closed | Pre-auth freeze order closed | false (does not trigger notification) |
fund_auth_freeze.init | Pre-auth freeze order created | false (does not trigger notification) |
Error codes
Error Code | Description |
ILLEGAL_ARGUMENT | The parameter is incorrect. Check each request parameter according to the API specification.
For cashier, get the customer to refresh the payment code and try the pre-auth again. |
UNIQUE_VIOLATION | Repeated order number. Get the cashier to cancel the order and retry. |
EXIST_FORBIDDEN_WORD | Prohibited words are included in the transaction request. |
ACCESS_FORBIDDEN | You have no permission to use the product. Check your agreement with Alipay. |
PAYEE_NOT_EXIST | The payee account does not exist. |
PAYEE_USER_STATUS_LIMIT | Abnormal payee account |
PAYER_USER_STATUS_LIMIT | Abnormal customer account |
ORDER_ALREADY_FINISH | Order completed |
ORDER_ALREADY_CLOSED | Order closed |
FREEZE_ALREADY_SUCCESS | Repeat operation |
ERROR_BALANCE_PAYMENT_DISABLE | Balance payment disabled |
SYSTEM_ERROR | System error |
MONEY_NOT_ENOUGH | Insufficient balance |
NO_PAYMENT_INSTRUMENTS_AVAILABLE | Payment channel unavailable |
PAYER_PAYEE_EQUAL | The payer and payee cannot be the same. |
CURRENCY_VERIFICATION_FAIL | Incorrect currency |
SECONDARY_MERCHANT_STATUS_ERROR | Abnormal secondary merchant status |
Sample
Request sample
https://openapi.alipaydev.com/gateway.do?app_id=2018060601228996&biz_content=%7B%22out_order_no%22%3A%22ORDER_20210512110137%22%2C%22out_request_no%22%3A%22REQUEST_20210512110137%22%2C%22product_code%22%3A%22OVERSEAS_INSTORE_AUTH%22%2C%22order_title%22%3A%22Mika's%20coffee%20shop%22%2C%22amount%22%3A%22100%22%2C%22pay_timeout%22%3A%221d%22%2C%22payee_user_id%22%3A%222088621898856371%22%2C%22trans_currency%22%3A%22USD%22%2C%22settle_currency%22%3A%22USD%22%2C%22extra_param%22%3A%7B%22secondaryMerchantId%22%3A%22110000010%22%2C%22outStoreCode%22%3A%221%22%7D%7D&charset=UTF-8&format=JSON&method=alipay.fund.auth.order.voucher.create&sign=EBA9Mkforsakmmr8RKB90zyE%2BqD0r2e3SROTv%2F0cs3Bq2CVxLsuKKtw0EF0c0eRSqDwNNgnDXiNG7W3ImlyFT1pOveniaGCK7fEEwyfw%2BsfSjQkGmqraUZIR%2BTFiLBr08UYITfbC5V%2BLuQtTg9iau1ja7bAQrBvIDquAE4QDRrk%3D&sign_type=RSA×tamp=2021-05-12%2011%3A01%3A37&version=1.0