Skip to main content

Create


  • Description: Create an order and obtain URL to the hosted checkout page
  • Path: /hosted-checkout/create
  • Method: POST
  • Request Header: Content-Type: application/json

Request Parameters

ParameterTypeMandatoryDefaultDescription
merchantIdStringMMerchant identifier
currencyStringOHKD3-Letters ISO currency code, supports HKD, USD
amountNumber(9,2)MOrder amount
merchantReferenceString(64)MAn unique reference to identify this order
callbackUrlObjectO
callbackUrl.successStringOURL to redirect after successful payment
callbackUrl.failStringOURL to redirect after failed payment
callbackUrl.cancelStringOURL to redirect when payment is cancelled
callbackUrl.notifyStringOAPI URL in merchant's backend to receive notification
isRecurringBooleanOfalseEnable/disable recurring payment
expiryTimeDatetimeOnow + 1000sExpiry time in ISO 8601 format.
lineItemsArrayMList of line item objects (1..n items)
lineItems[index].quantityNumber(8)MNumber of items, must be integer
lineItems[index].priceDataObjectMPrice data object
lineItems[index].priceData.unitAmountNumber(9,2)MUnit amount of the item
lineItems[index].priceData.nameStringMName of the item
langStringOWeb browser defaultDefault language: zh-HK or en
showLangBooleanOtrueShow/hide language options
showPoweredByBooleanOtrueShow/hide Powered by BBMSL text at bottom
paymentMethodsStringOAll available payment methodsSupported payment methods, comma-separated: CARD, APPLEPAY, GOOGLEPAY, ALIPAYHK, ALIPAYCN, WECHATPAY
defaultPaymentMethodStringOPreselected payment method. Fallbacks to first if unavailable. See above for values.
allowedBinRangesArrayOOnly allow card numbers within bin ranges (VISA & Mastercard)
allowedBinRanges[index].binStartString(4-8)MStart of bin range, e.g., 4812, 540820, 3742
allowedBinRanges[index].binEndString(4-8)MEnd of bin range, must match binStart length, e.g., 4814, 540870, 3748
allowedCardTypeStringORestrict to card type, applies to CARD, APPLEPAY, GOOGLEPAY: VISA, MASTER, UNIONPAY
showOrderDetailBooleanOtrueShow/hide order item list
showEmailBooleanOtrueShow/hide email input field
showMerchantReferenceBooleanOtrueShow/hide order's merchant reference (top right)
showOrderIdBooleanOtrueShow/hide order ID
showResultPageBooleanOtrueShow/hide result page (requires callbackUrl if false)
themeColorStringOOrder page background color, e.g., #1F2F3F
buttonBackgroundColorStringOButton background color, e.g., #1F2F3F
buttonFontColorStringOButton font color, e.g., #1F2F3F

Example

{
"request": "{\"currency\":\"HKD\",\"amount\":270,\"callbackUrl\":{\"success\":\"google.com\"},\"lineItems\":[{\"priceData\":{\"name\":\"Books\",\"unitAmount\":50},\"quantity\":5},{\"priceData\":{\"name\":\"Shipping Cost\",\"unitAmount\":20},\"quantity\":1}],\"allowedBinRanges\":[{\"binStart\":\"4812\",\"binEnd\":\"4816\"},{\"binStart\":\"540820\",\"binEnd\":\"540870\"}],\"merchantId\":\"3\",\"merchantReference\":\"merRef1709258105036\",\"isRecurring\":false,\"buttonBackgroundColor\":\"#3DAD02\",\"buttonFontColor\":\"#FFFFFF\",\"showPoweredBy\":false}",
"signature": "lKjsmv+dpl9nPap5pTkNROzUdQYWOhkWJrjp+jyimGb74NL61DAvLq+5kUI8HEhKxGBzdyoGm1jp2Dq0aD3gIii3FHvpopTtWtIMawy2a4rsE8HA/zKUmEsw3YtEaYeT+5ULfDq4E6my0UvOA5VsgbfYYif0MvBPKsXOw6O0TMa4X3JoS8ZmEcsJ5RqNJB5DNh68GUclgaHotH4kcuaSzH0Hw1ZoXX/20j3lXsFgJNkHSsNsVMKfrFgzTUq/mcNkcnhcj5BKxhtU5APYAAzk0gWQZq14nnFog6IQSXInZU7f+cvm3N/AvxjwmvYkZVPLdMLDaRQaStHOVN4P+pWbtA=="
}

Response Parameters

ParameterTypeMandatoryDescription
responseCodeStringMPayment Gateway response code
messageStringMPayment Gateway response message
checkoutUrlStringMURL to hosted checkout page
orderObjectMObject contains order details
order.idNumberMOrder identifier. If it is recurring payment, save this value as next recurring payment's parentOrderId
order.merchantIdNumberMMerchant identifier which own this order
order.merchantReferenceStringMYour reference for the order
order.currencyStringM3-Letters ISO currency code of the order
order.amountNumberMAmount of order
order.netAmountNumberMNet amount of the order
order.createTimeDatetimeMTimestamp when the order is created. Maintained by the Payment Gateway
order.updateTimeDatetimeMTimestamp when the order is last updated. Maintained by the Payment Gateway
order.statusStringMStatus of the order. Maintained by the Payment Gateway
order.recurringBooleanMFlags the order is a recurring order or not

Example

{
"responseCode": "0000",
"message": "SUCCESS",
"checkoutUrl": "https://checkout.sit.bbmsl.com/order?sid=77ce7651ac7d4703a94c74d4598fbf14",
"order": {
"id": 4920,
"merchantId": 9000067,
"merchantReference": "merRef1698373981165",
"currency": "HKD",
"amount": 550,
"netAmount": 0,
"createTime": "2023-10-27T02:33:02.307+00:00",
"updateTime": "2023-10-27T02:33:02.493+00:00",
"status": "OPEN",
"recurring": false
}
}