Skip to main content

Sale


  • Description: Create sale payment
  • Path: /direct/sale
  • Request Header: Content-Type: application/json

Request Parameters#

ParameterTypeRequiredDescription
merchantIdstringRequiredMerchant identifier
amountnumberRequiredThe payment amount
merchantReferencestringRequiredA reference for you to identify this payment, must be unique
paymentTypestringRequiredPayment type. Value can be ALIPAY, ALIPAYHK, WECHAT
paymentTerminalstringRequiredPayment terminal type. Value can be SDK, WAP, PCWEB
notifyUrlstringOptionalMerchant backend listening endpoint, to receive notification
lineItemsarrayRequired 
lineItems[index].quantitynumberRequiredNumber of items
lineItems[index].priceDataobjectRequiredPrice data object with details
lineItems[index].priceData.unitAmountnumberRequiredUnit amount of the item
lineItems[index].priceData.namestringRequiredName of the item

Example request:

{
"request": "{\"merchantId\":\"3000001\",\"amount\":100.2,\"notifyUrl\":\"https://www.bbmsl.com/notify\",\"merchantReference\":\"Hello0331\",\"paymentType\":\"WECHAT\",\"paymentTerminal\":\"SDK\",\"lineItems\":[{\"quantity\":1,\"priceData\":{\"unitAmount\":1.22,\"name\":\"Book\"}}]}",
"signature":"c1hTR2RBNHRSNEIwd25GNk5yOFNocGZOTXRISVNXdXpMcGRLb05Xc2tJZ0Njc3BNVkZGemdrZXo0QnJtdFlYa01xWmgxdHl6LzhzTk5VM0YyVlR1MGZPeCtaUDRDbm1Wak51OGJjaXU0aFR0bnl0QTNZMUdaL3lYQVVEK21WWUdYZXlETzNmSHJxRGRJN2szeFYvUThGQ09kMGN1bFRzTjZSUk14TVpxK29xUjJ4K0VqT1hWb2ZwN0JaSndoUUU4VXM0QWw1NzNGUXo1RUhEdkNMeDM1bHEyaG9NaFhMQ1ZMVkRCSGNwQ2dvdHVZNG1nOTFNWGgvcXFjRkdZL2hRS2hHZFdBYlo5dGNwMlE1czJFU2gzN3JxeG5Pd1pycmVwSzhOQzZ2TUJQVWlTUHhRZWZwZXYybkcwSnpBSE9qUlBiQlhZdzFYQlM2UkJZS0FtdWZaWmlRPT0="
}

Response Parameters#

ParameterTypeRequiredDescription
responseCodestringRequiredPayment Gateway response code
messagestringRequiredPayment Gateway response message
wechatOrderobjectOptional 
wechatOrder.appIdstringOptionalThis identifier is issued after vendors apply for official account supporting WeChat payment
wechatOrder.partnerIdstringOptionalSpecifies vendor ID assigned by WeChat Payment. It is the sub mch_id when calling the unified order API
wechatOrder.packageValuestringOptionalWechat package value
wechatOrder.nonceStrstringOptionalRandom string to ensure unpredictability for signatures
wechatOrder.timeStampstringOptionalSpecifies the current time
wechatOrder.signstringOptionalSpecifies a signature
alipayDatastringOptionalAlipay response data

Example:#

Wechat response:

{
"responseCode": "0000",
"message": "SUCCESS",
"wechatOrder": {
"appId": "wx7146xxxxxxxx61b",
"partnerId": "19xxxxx731",
"packageValue": "Sign=WXPay",
"nonceStr": "4f2695d4f88b4b599919d202b8fa1847",
"timeStamp": "1638861037",
"sign": "CrJ34TMAEXfazilrh8ek/JAcKNgTpRyUgZHtubpXwGS50FIme9MoAR1FOaV5BHzDBDgzZYZYM/GYWrIx8qOd50563WmsWv0KAhelrSDcTkGWFsFbBw9lF8ZQ0asVYrvBhZUz7HPg92bfLmTnkGm1AK5uKyHFkRq8eYipsOiAe8GRXpviXTd4Ov9At2hSzmtIUA2aH5H/cA0QGCQFWaIVIkiTiX1x/X34IDCDWuCpjypSMwlEra8i45Qsu1pKMbYKOrhNFDaV9kHQlARokm0VtRbzQUZZFpQQ5DtIvFsQWIxV9XCdp3+pNcHeZ1SXWvws8UveAGNy7wsOoJmtHnf/kw=="
}
}

Alipay response:

{
"responseCode": "0000",
"message": "SUCCESS",
"alipayData": "secondary_merchant_industry=\"5965\"&payment_inst=\"ALIPAYHK\"&subject=\"Service\"&_input_charset=\"utf-8\"&it_b_pay=\"30m\"&body=\"Product\"&notify_url=\"https://payapi.dev.bbposmsl.com/direct/notify/alipay\"&product_code=\"NEW_WAP_OVERSEAS_SELLER\"&secondary_merchant_id=\"BBPOS574\"&payment_type=\"1\"&out_trade_no=\"S2886\"&partner=\"20880xxxxxxxx053\"&service=\"mobile.securitypay.pay\"&total_fee=\"0.1\"&secondary_merchant_name=\"BBPOSMSL\"&return_url=\"30m\"&currency=\"HKD\"&seller_id=\"20880xxxxxxxx053\"&forex_biz=\"FP\"&sign=\"Y8Gyfh7nhtWWijxB92cYSj4dmR3VbCpOeeDBW5HRVUeqAbbFByf%2FmgTeJPCoiSuupPS4j47vMFQIrLSoYsfBDzlRxQeQ1CYj6Ez02X3VeUvOi5efkLVNWYa1kJ7ZmfRvD%2F1pa%2Bwf11rv9NHRAANrlsPziVXxjnOtmclX0XqLCAvjm4kCnjZJtm6XOCGhNpUdXBpkkJEnHF9OUtlbT4WBQ3uOCFjczYOweCOEVA1adio%2FVpKnSTMFM2tvrGmJ%2BNxzPY93jBZwgCO8pePy6jZDqmH4ShL1c10BqoD6YDor2cwoeN7PM1sTqRfnVvgqSmZk1%2BjW7vn3mucJ%2FCC65tpnTQ%3D%3D\"&sign_type=\"RSA2\""
}
  1. Alipay
    PayTask alipay = new PayTask(YourActivity.this);
    final String result = alipay.pay(aboveBBMSLResponse.getAlipayData(), true);
  2. Wechatpay
    • Before you can start accepting WeChat Pay in-app payments, you need to:
    • 2.1 Create a developer account on the WeChat Open Platform. https://open.weixin.qq.com/
    • 2.2 Register your mobile app on WeChat Open Platform. After you get the appId, please contact BBMSL technical support and send the appId to technical support.
    • 2.3 Integrate WeChat's mobile SDKs. https://developers.weixin.qq.com/doc/oplatform/Downloads/iOS_Resource.html
    • After get above response from BBMSL, please call below method to invoke Wechatpay to finish payment.
    WechatOrderRes wechatOrder = aboveBBMSLResponse.getWechatOrder();
    PayReq request = new PayReq();
    request.appId = wechatOrder.getAppId();
    request.partnerId = wechatOrder.getPartnerId();
    request.prepayId = wechatOrder.getPrepayId();
    request.packageValue = wechatOrder.getPackageValue();
    request.nonceStr = wechatOrder.getNonceStr();
    request.timeStamp = wechatOrder.getTimeStamp();
    request.sign = wechatOrder.getSign();
    boolean result = api.sendReq(request);