alipay.intl.acquiring.cashier.wap.pay

You can use this interface to integrate an in-app payment.

Request parameters

NoNameDescriptionTypeLengthRequiredRemarksSample
1versionAPI versionstring8YAs per the respective API reference2.0.0
2functionAPI interfacestring128YAccording to specifications defined by each business domainalipay.intl.acquiring.cashier.wap.pay
3clientIdClient IDstring32YProvided by Alipay, used to identify partner and application system4Q5XSH6SSG02T006
4reqTimeRequest timedatetime/YDateTime with timezone, which follows the ISO-8601 standard.Refer to: RFC 3339 Section 5.62018-12-04T22:00:53-08:00
5reqMsgIdRequest message IDstring64YEach request will be assigned with a unique id (uuid).The reqMsgId identify an unique system request, it is not used to identity an unique business request.2b76d599f8072d042b68bc2f43be4211
6reserveReserved for future implementationstring256NKey/Value{}

Body 

NoNameDescriptionTypeLengthRequiredRemarksSample
1merchantIdThe merchant id, which identifies the settlement target that Alipay would settle to.string 64Y2160400000002012
2productCodeThe product code.enums<productcode>64YAGREEMENT_OR_CASHIER_PAY
3merchantTransId Unique merchant transaction id.string64Y201904030205425512477
4orderThe order information.Order/YThe orderAmount should be provided in the smallest common currency unit.For example, to create a charge for $1.00, you would set orderAmount.value=100 (100 cents).

{

"orderAmount":{

        "currency":"HKD",

        "value":"1000"

    },

    "orderTitle":"Women Summer Dress",

    "orderDetail":"testOrder",

    "seller":{

        "sellerId":"2160400000002012",

        "mcc":"1234",

        "sellerName":"COD"

    }

}

5settleContractId

The settlement contract id. If not provided, the default settlement contract will be used.Merchant might want to be settled in different ways for different situations, each of which could be defined by a settlement contract. For example, a merchant could have a settlement contract for USD settlement while has another settlement contract for CAD settlement.  

Note: If not provided, the default settlement contract will be used.

string64NUSD-1
6riskInfoRisk information. Highly recommend to provideRiskInfo/N

{
    "deviceInfo":{
        "sessionId":"26daf780047938bf8d5b7ea8906003e9",
        "serialNo":"f0c0ec9a",
        "clientIp":"121.0.29.220",
        "latitudeLongitude":"39.9151190000,116.4039630000",
        "idfa":"5D08BADB6-B7D1-46DE-BDAB-B66468A1EFCC",
        "terminalType":"APP",
        "deviceName":"Mike's iPhone",
        "deviceBrand":"APPLE",
        "deviceModel":"iPhone 7 Plus",
        "imei":"863360020885012",
        "osName":"ios",
        "osVersion":"9.1.1",
        "wirelessNetwork":"china unicom",
        "wirelessCarrier":"china unicom",
        "flightMode":"enabled",
        "fingerPrintEnabled":"enabled",
        "deviceBootTime":"2001-07-04T12:08:56+05:30",
        "lastUnlockTime":"2001-07-04T12:08:56+05:30",
        "screenResolution":"1024*768",
        "isJailbreaked":"true",
        "macAddress":"8c:be:be:71:1f:34",
        "systemLanguage":"EN",
        "timeZone":"UTC+11"
    },
    "userInfo":{
        "signupTime":"2001-07-04T12:08:56+05:30",
        "lastLoginTime":"2001-07-04T12:08:56+05:30",
        "merchantUserId":"user0001"
    },
    "orderInfos":[
        {
            "productName":"iPhone 7",
            "productCategory":"Phone",
            "productSubCategory":"smart phone",
            "itemPrice":{
                "currency":"USD",
                "value":"239"
            }
        }
    ],
    "riskExtendInfo":"{}"
}

7extendInfoReserved for extended infostring2048NKey/ValueNote the type of "extendInfo" is string. See example in the request sample.{"productScene":"Prepay/Paybill"}
8notifyUrlNotify URL for a completed paymentstring512Nhttps://q43tb6ekkc.execute-api.ap-northeast-1.amazonaws.com/dev/ipay-notify/in-store/2160400000002013
returnUrlRedirect URL after payment finishedstring512N After payment is done, the result is returned to this URL via the URL redirect.https://sbs-mobops.sandbox-payment.com/debug/tc/wap_pay_result.html

Request Sample

{

"request":{

"head":{

"version":"2.0.0",

"reqMsgId":"2b76d599f8072d042b68bc2f43be4211",

"reqTime":"2018-12-04T22:00:53-08:00",

"clientId":"4Q5XSH6SSG02T006",

"reserve":"{}",

"function":"alipay.intl.acquiring.cashier.wap.pay"

},

"body":{

"merchantId":"2160400000002012",

"productCode":"AGREEMENT_OR_CASHIER_PAY",

"merchantTransId":"201904030205425512477",

"order":{

"seller":{

"sellerId":"2160400000002012",

"sellerName":"COD",

"mcc":"1234"

},

"orderAmount":{

"currency":"HKD",

"value":"1000"

},

"orderDetail":"testOrder",

"orderTitle":"testTitle"

},

"notifyUrl":"https://q43tb6ekkc.execute-api.ap-northeast-1.amazonaws.com/dev/ipay-notify/in-store/2160400000002013",

"returnUrl":"https://sbs-mobops.sandbox-payment.com/debug/tc/wap_pay_result.html",

"extendInfo":"{\"productScene\":\"Prepay\"}"

}

},

"signature":"XXX"

}

Merchant can sign the value of above request sample to get the sign and construct an orderStr sample like below:

{"request":{"head":{"version":"2.0.0","reqMsgId":"2b76d599f8072d042b68bc2f43be4211","reqTime":"2018-12-04T22:00:53-08:00","clientId":"4Q5XSH6SSG02T006","reserve":"{}","function":"alipay.intl.acquiring.cashier.wap.pay"},"body":{"merchantId":"2160400000002012","productCode":"AGREEMENT_OR_CASHIER_PAY","merchantTransId":"201904030205425512477","order":{"seller":{"sellerId":"2160400000002012","sellerName":"COD","mcc":"1234"},"orderAmount":{"currency":"HKD","value":"1000"},"orderDetail":"testOrder","orderTitle":"testTitle"},"notifyUrl":"https://q43tb6ekkc.execute-api.ap-northeast-1.amazonaws.com/dev/ipay-notify/in-store/2160400000002013","returnUrl":"https://sbs-mobops.sandbox-payment.com/debug/tc/wap_pay_result.html ","extendInfo":"{\"productScene\":\"Prepay\"}"}},"signature":"XXX"}

 

To obtain the signed JS orderStr, see the sample below:

{\"request\":{\"head\":{\"version\":\"2.0.0\",\"reqMsgId\":\"2b76d599f8072d042b68bc2f43be3197\",\"reqTime\":\"2018-12-04T22:00:53-08:00\",\"clientId\":\"4Q5XSH6SSG02T006\",\"reserve\":\"{}\",\"function\":\"alipay.intl.acquiring.cashier.wap.pay\"},\"body\":{\"merchantId\":\"2160400000002012\",\"productCode\":\"AGREEMENT_OR_CASHIER_PAY\",\"merchantTransId\":\"201904030205425512477\",\"order\":{\"seller\":{\"sellerId\":\"2160400000002013\",\"sellerName\":\"COD\",\"mcc\":\"1234\"},\"orderAmount\":{\"currency\":\"HKD\",\"value\":\"1000\"},\"orderDetail\":\"testorder\",\"orderTitle\":\"testTitle\"},\"notifyUrl\":\"https://q43tb6ekkc.execute-api.ap-northeast-1.amazonaws.com/dev/ipay-notify/in-store/2160400000002013\",\"returnUrl\":\"https://sbs-mobops.sandbox-payment.com/debug/tc/wap_pay_result.html\",\"extendInfo\":\"{\\\"productScene\\\":\\\"Prepay\\\"}\"}},\"signature\":\"XXX\"}

Response Sample

CALLBACK illustration

NameTypeDescription
resultCodeStringThe resultCode Status are listed in the following table.

 

resultCode Status

resultCode

Implication

9000

Successful order payment

8000

Under processing, unknown payment result. The payment might be successful, you need to inquiry the order payment status in sellers' orders list. (This code is returned from AlipayHK server side.)

4000

Failed order payment

7001

The payment is stopped from the client end

6001

Canceled by the user during the process

6002

Errors exist in the network connection

6005 

Exceptions occurred in the client end

5000

Duplicate payment

Sample code

<script>

document.addEventListener('AlipayJSBridgeReady', function () {

AlipayJSBridge.call("setTitle", {

title: "iPay test",

subtitle: "alipay.intl.acquiring.cashier.wap.pay"

});

}, false);

function pay(){

var amt = document.getElementById('amt').value;

alert(amt);

$.ajax({

url : '/sbs-api/debug/bsu/wap/pay',

contentType: 'application/json',

method : 'POST',

data : JSON.stringify({"mid":"2160400000002012", "amount":amt}),

success: function(result){

alert(result.order_string);

AlipayJSBridge.call('tradePay', {

orderStr: result.order_string,

version:"2.0.0"

}, function (result) {

alert("callback result:" + JSON.stringify(result));

// if (result.resultCode == 9000) {

// this.resultHandler({ "out_trade_no": result.outTradeNo, "result_code": result.resultCode });

// } else {

// this.resultHandler({ "result_code": result.resultCode });

// }

});

}

});

}

</script>