文档中心 > 当面付-英文版

alipay.trade.pay

更新时间:2017/06/07 访问次数:16174

Use case:
The cashier scans the QR code of the user’s payment info in Alipay Wallet, then calls this API with the QR code info to complete the payment process.

Remarks:
There is no async notification in this payment method. Please do not set the value in ”notify_url” field

Common Parameters

Parameter Type Mandatory Length Description Sample
app_id String Y 32 An app id assigned to the developer by Alipay 2014072300007148
method String Y 128 api name alipay.trade.pay
charset String Y 10 The char set for request use, like utf-8, gbk, gb2312, etc. utf-8
sign_type String Y 10 The type of signature algorithm used by the merchant to generate the signature string. Currently RSA and RSA2 are supported. RSA2
sign String Y 256 Signature string
timestamp String Y 19 The sending time of the request, formatting in “yyyy-MM-dd HH:mm:ss” 2014-07-24 03:07:50
version String Y 3 The version of this API, hard coded as 1.0 for now. 1.0
app_auth_token String N 40 Please refer to the section “application authorization”

Request Paramenters

parameter Type Mandatory Length Description Sample
out_trade_no String Y 64 The transaction id from the partner.
This is used for idempotence check.
2088101568338311
scene String Y 32 “bar_code” for bar code payment bar_code
auth_code String Y 32 Auth code from the Alipay Wallet 28763443825664394
seller_id String N 28 If null, it will be defaulted with the user id of the merchant 2088102146225135
total_amount Price N 11 Total amount in CNY. The number should be in the form of 0 or 2 digits after the decimal point.
If we pass in “discountable_amount” and “undiscountable_amount” in the mean time, the parameter can be skipped

If we pass in “total_amount”, “discountable_amount” and “undiscountable_amount” in the same time, then we must have total_amount = discountable_amount + undiscountable_amount
88.88
discountable_amount Price N 11 The amount that will be discountable. The unit is 1 CNY. The number should be in the form of 0 or 2 digits after the decimal point.
If the parameter is skipped, and we pass in “discountable_amount” and “total_amount” in the mean time, the default value will be: total_amount - discountable_amount
8.88
undiscountable_amount Price N 11 The amount that will not be discountable. The unit is 1 CNY. The number should be in the form of 0 or 2 digits after the decimal point.
If the parameter is skipped, and we pass in “undiscountable_amount” and “total_amount” in the mean time, the default value will be: total_amount - undiscountable_amount
80.00
subject String Y 256 The name of the item. It should not contain special symbols. Iphone6 16G
body String N 128 The detailed description of the item. It should not contain special symbols. Iphone6 16G
goods_detail GoodsDetail[] N The item details of the order. It is a JSON string represents an array of product items.
Please refer to later session for details.
[{“goods_id”:“apple-01”,“goods_name”:“ipad”,“goods_category”:“7788230”,“price”:“2000.00”,“quantity”:“1”}]
└goods_id String Y 32 goods id apple-01
└alipay_goods_id String N* 32 Alipay unified goods id. 20010001
└goods_name String Y 256 goods name ipad
└quantity Number Y 10 goods quantity 1
└price Price Y 9 goods unit price for Yuan 2000
└goods_category String N* 24 goods category 34543238
└body String N* 1000 goods description discounted phone
operator_id String N 28 Operator id. Yx_001
store_id String N 32 Store id. NJ_001
terminal_id String N 32 Terminal id. NJ_T_001
extend_params ExtendParams N Business development parameter. {“sys_service_provider_id”:“2088511833207846”}
└sys_service_provider_id String N* 64 Isp number,this parameter is for isp return commission data extraction, please fill in ISP pid. 2088511833207846
timeout_express String N 6 The time span that the payment is allowed to be completed. The value is from 1 min(1m) to 15 days (15d).
m-minute,h-hour,d-day,1c-current day. When the value is set to 1c. The order will be close at 0 am next day.The value of the number must be integer. We can set the value to 90m instead of 1.5 hour.
90m
royalty_info RoyaltyInfo N Describe fee split info in Json format.
└royalty_type String N* 150 The seller’s type of fee split, currently only ROYALTY (normal type) is supported. ROYALTY
royalty_detail_infos RoyaltyDetailInfos[] Y 2500 detailed info of fee split,can describe multiple fee split commands, in Json format
└serial_no Number N* 9 Fee split’s serial number,which means the order of fee split actions, must be positive. 1
└trans_in_type String N* 24 The type of account which receives fee split. User_id: the unique id that matches Alipay account
bandindex: the bank id after fee split to the bank account. Now only one bank id split is allowed.
storeid:the corresponding bank card id for the split store. The default is userid.
userid
└batch_no String Y 32 The split batch number. Currently need to use together with bankindex account. 123
└out_relation_id String N* 64 The external connected account for the merchants split which is used to connect each split information. The merchants need to secure the uniqueness. If it is empty, the default will be set as “the uniqe order number from the merchant plus the split serial numbernumber.” 20131124001
└trans_out_type String Y 24 The account type of the account needs to split.Currently only userid is supported. The default is set as userid. userid
└trans_out String Y 16 If the trans out account type is userid, this parameters is the Alipay account needs to split corresponding to the unique Alipay userid, starts with 2088(numbers only). 2088101126765726
└trans_in String Y 28 If the trans in account type is userid, this parameters is the Alipay account needs to accept split fee corresponding to the unique Alipay userid,starts with 2088(numbers only).
If the tran in account type is bankindex, this parameters will be the 28-digit bank id. If the trans in account type is storeid, this parameters will be the merchant’s store id.
2088101126708402
└amount Number Y 9 The split amount in Yuan 0.1
└desc String N* 1000 The description of split info 分账测试1

Remarks:
If the terminal manufacturer integrates with the solution, terminal_id would be mandatory, while store_id and seller_id would be optional.
If the store system integrates with the solution, store_id would be mandatory, while terminal_id and seller_id would be optional.
If the store_id that passed in by the merchant does not match with the store_id previously input, then we could not verify and redeem the store’s marketing campaigns and coupons.

Sample:

method=alipay.trade.pay,
app_id=2014072300007148,
charset=utf-8,
sign_type=RSA2,
sign=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAL4HgSt9hfOpv9MSwgUvfpgOH7WkC7WrTr84m29b0VfnZtK+9jv/YPXYr+22DrxfWJkdPiXJvSjifxPudlqjX21l6/8k79i/4HRCz8DBcdw5jqROfpoq0l3vYfPVqJGwSqaPhtM1Bb4hAD2yLlN2ukfCbshSntUEFd4ozocLolW/AgMBAAECgYBVHTNj8WMQElYTCnHQtMc1AA5/4yxDgKlSyN4F8NBBWSoa9uF/WhFpzFZwWH0dLm+WlRyC/Gs3ZsuYd9SXIFna9mv49+cEfObSzJhvW5DXOVCi+c4Ap3cTsXZiAj8DMsoCb9OjRHNl/BqzN0kl0Wm1diZvXl9YgSRqbzpXzoj4oQJBAOYLSk87XFYodvwr4aL3KFjZZZhHj1Jpp/q61SNgB03aXqZu9m+hk1X4mTGn4rhA7Cl2ZuL+OoxxnJFDw0cbMRcCQQDTeGgx0VUC+O3zAtzMmocjE7WuesRC3IjhU30of4GGjQzIXvKOQCCuUF2DHvIkrB/k2E75n8+TI9matbLS11mZAkEAtSek7/oF/89Dy9dei2/o9PbVu3J22eZcIuVoHMBtYBCbwqLVLBloJiZrtR/JOWHe19Pmt9COGLULH5XmPKOcJwJAUZnP0xFs1XXLFA/Rtd4XMXDklYxn+UjyRMibrintiEcbXKJOxJd4ROtb+kHRvFbzA7J4XxjM14Fo8asVcwiIWQJAVco+9qQzZ7JZzFzk0KTWhQlfbcRByLX25XIPbIes2lmY2uM895yrY/8kbGx2JgD/VGITWwth+uuutXUQ9K6HIw==",
timestamp=2014-07-24 03:07:50",
biz_content={
    "out_trade_no": "201503022001",
    "scene": "bar_code",
    "auth_code": "28763443825664394",
    "total_amount": "88.88",
    "discountable_amount":"8.88",
    "undiscountable_amount ": "80",
    "subject": "当面付条码支付",
    "goods_detail": [
    {
        "goods_id": "apple-01",
        "goods_name": "ipad",
        "goods_category": "7788230",
        "price": "88.88",
        "quantity": "1"
    }
    ],
"operator_id": "op001",
"store_id": "pudong001",
"terminal_id": "t_001",
"timeout_express": "90m"
}

Response Parameter in Synchronous Return

The Result of “Success”

Parameter Type Mandatory Length Description Sample
trade_no String Y 64 Alipay Transaction ID. 2013112011001004330000121536
out_trade_no String Y 64 out_trade_no passed in by the merchant in the request 6823789339978248
buyer_logon_id String Y 100 The buyer’s Alipay account id,part of which will be replaced by ‘*’. 159****5620
total_amount Number Y 11 The total amount of the payment. 88.88
receipt_amount Number Y 11 The total amount to be received by the merchant in the settlement, in CNY. 8.8
invoice_amount Number Y 11 The invoice amount in the payment, in CNY. 10.00
buyer_pay_amount Number Y 11 The total amount that the buyer will pay, in CNY. 13.88
point_amount Number Y 11 The total amount that the buyer will pay in the Alipay reward point program, in CNY. 12.00
gmt_payment Date Y 32 The creation time of the payment. The format is in “yyyy-MM-dd HH:mm:ss”. 2014-11-27 15:45:57
fund_bill_list TradeFundBill[] Y The amount info for all the funding channels in a successful payment. Please refer to section "Detailed funding channel info”.
└fund_channel String N The channel used to pay.
└ amount Price N The amount used via this type of payment.
card_balance Price N 11 the balance on Alipay 98.23
buyer_user_id String Y 16 The user id associated with the buyer’s Alipay account, in the format of 16 digit number starting with “2088”. 2088102122524333
store_name String N 52 The store name where the payment happens. 证大五道口店
discount_goods_detail String N The item which have a discounted price in this order. Only the discounted item will be returned. In JSON format. Please refer to “Detailed description of discounted items”

Sample:

{
"alipay_trade_pay_response": {
    "code": "10003",
    "msg": "订单创建成功支付处理中",
    "trade_no": "2013112011001004330000121536",
    "out_trade_no": "6823789339978248",
    "buyer_user_id": "2088102122524333",
    "buyer_logon_id": "159****5620",
    "total_amount": "88.88"
},
"sign": "jfAz0Yi0OUvAPqYTzA0DLysx0ri++yf7o/lkHOHaG1Zy2fHBf3j4WM\n+sJWHZUuyInt6V+wn+6IP9AmwRTKi+GGdWjPrsfBjXqR7H5aBnLhMsAltV7v4cYjhug\nuAqh4WkaJO6v6CfdybDpzHlxE6Thoucnad+OsjdCXkNd1g3UuU=\n"
}

The Result of “Failed” Return

{
"alipay_trade_pay_response": {
    "code": "40004",
    "msg": "交易创建失败",
    "sub_code":"ACQ.EXIST_FORBIDDEN_WORD",
    "sub_desc":"订单信息中包含了违禁词"
},
"sign": "jfAz0Yi0OUvAPqYTzA0DLysx0ri++yf7o/lkHOHaG1Zy2fHBf3j4WM\n+sJWHZUuyInt6V+wn+6IP9AmwRTKi+GGdWjPrsfBjXqR7H5aBnLhMsAltV7v4cYjhug\nuAqh4WkaJO6v6CfdybDpzHlxE6Thoucnad+OsjdCXkNd1g3UuU=\n"
}

Error Codes

Name Error Description Solution
ACQ.SYSTEM_ERROR System error, such as system time out Call the inquiry API ASAP, and proceed accordingly with the order’s status.
ACQ.INVALID_PARAMETER At least one of the parameters is not valid Examine the request parameters and resend the request after fixing the issue.
ACQ.ACCESS_FORBIDDEN No right to access the solution. Most likely the merchant did not sign the contract or the contract expired. Contact Alipay Customer Support(CS) to sign/renew the proper contract for the solution
ACQ.EXIST_FORBIDDEN_WORD There is forbidden words in the order info(title, subject and description field). Resend the request after fixing the issue.
ACQ.PARTNER_ERROR Invalid APP_ID Contact Alipay CS to get the valid APP_ID
ACQ.TOTAL_FEE_EXCEED The total amount is over the limit Resend the request after fixing the order amount.
ACQ.PAYMENT_AUTH_CODE_INVALID The auth code is invalid, which could be used or with input error. The user can refresh the QR code and retry the payment.
ACQ.CONTEXT_INCONSISTENT The old information mismatches with those in the system. Resend the request after fixing the order info.
ACQ.TRADE_HAS_SUCCESS The payment is done successfully. Confirm if the payment belongs to the current buyer. If it is, then the payment is completed successfully. If it is not, update the out_trade_no field, and resend the request.
ACQ.TRADE_HAS_CLOSE The payment transaction exists and is closed. Update the out_trade_no field, and resend the request.
ACQ.BUYER_BALANCE_NOT_ENOUGH The buyer does not have enough balance to cover the payment. The buyer can add another bank card or add fund to the balance, then retry the payment.
ACQ.BUYER_BANKCARD_BALANCE_NOT_ENOUGH The buyer’s does not have enough balance to cover the payment Suggest the buyer to use another Alipay account or other payment methods.
ACQ.ERROR_BALANCE_PAYMENT_DISABLE The buyer disabled the balance payment function The buyer can retry after enabling the balance payment function.
ACQ.BUYER_SELLER_EQUAL The payment transaction has the same buyer and seller, which is not allowed. Update the buyer, and resend the request.
ACQ.TRADE_BUYER_NOT_MATCH The payment transaction exists and the buyer is different. Update the out_trade_no field, and resend the request.
ACQ.BUYER_ENABLE_STATUS_FORBID The buyer is not allowed to pay. Contact Alipay CS to confirm why the buyer is not allowed to pay.
ACQ.PULL_MOBILE_CASHIER_FAIL Failed to load mobile cashier The buyer can retry after refreshing the bar code.
ACQ.MOBILE_PAYMENT_SWITCH_OFF The buyer disables the mobile payment. The buyer can retry after enabling the mobile payment.
ACQ.PAYMENT_FAIL Failed to complete the payment The buyer can retry after refreshing the bar code. If the symptom persists after the retry, please switch to other payment methods.
ACQ.BUYER_PAYMENT_AMOUNT_DAY_LIMIT_ERROR The buyer is over the daily payment limit. Ask the buyer to pay with other accounts or payment methods.
ACQ.BEYOND_PAY_RESTRICTION The merchant is over the daily limit to receive fund. Contact Alipay CS to increase the limit.
ACQ.BEYOND_PER_RECEIPT_RESTRICTION The merchant is over the monthly limit to receive fund. Contact Alipay CS to increase the limit.
ACQ.BUYER_PAYMENT_AMOUNT_MONTH_LIMIT_ERROR The buyer is over the monthly payment limit. Ask the buyer to pay with other accounts or payment methods.
ACQ.SELLER_BEEN_BLOCKED The merchant is restricted. Contact Alipay CS to unlock the account.
ACQ.ERROR_BUYER_CERTIFY_LEVEL_LIMIT The buyer does not pass the id certification process. Let the buyer to complete the payment with other methods, and contact Alipay CS to resolve the issue.
ACQ.PAYMENT_REQUEST_HAS_RISK Alipay decides there is high risk with the payment Ask the buyer to pay with other payment methods.
ACQ.NO_PAYMENT_INSTRUMENTS_AVAILABLE The buyer has no valid payment methods to complete the payment Ask the buyer to pay with other payment methods.
ACQ.USER_FACE_PAYMENT_SWITCH_OFF The user has disabled bar-code payment method. Ask the buyer to enable bar-code payment method.

FAQ

关于此文档暂时还没有FAQ
返回
顶部