Gateway interface integration guide
#
1. Interface description#
Request URLThe actual request address of all interface URLs is payment gateway address + interface URL
The exclusive payment gateway address can be obtained by contacting ksher.
#
Response http Status CodeWhen the http status code is 200, the response contains error_code and error_message fields, indicating the result of this request
Create an order, query an order, and refund an order. When the call is successful, the interface will return the order details .
http status code | instruction |
---|---|
200 | Success |
400 | Request parameter format verification failed |
401 | unauthorized |
403 | Permission denied |
404 | The requested resource does not exist |
#
400 response example#
2. Redirect payment#
Create Order#
APIURL | /api/v1/redirect/orders |
---|---|
Method | POST |
Content-Type | application/json |
#
Request parameter#
Body parametername | Location | Types | required | instruction |
---|---|---|---|---|
merchant_order_id | body | string | Yes | The unique order number used by the merchant |
amount | body | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
redirect_url | body | string | Yes | The url to be redirected after the client's payment is completed |
redirect_url_fail | body | string | Yes | The url to be redirected after the client payment is not completed or cancelled |
note | body | string | No | order notes |
timestamp | body | string | Yes | Timestamp |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
provider | body | string | No | Payment gateway, optional values ('th','ph','my') |
product_name | body | string | No | Name or description of your product. Precautions when using "product_name" please use General English characters. Avoid using special characters such as +&/$%. Because in some wallets, product_name will be shown to the product that the customer purchases. and wallet does not support special characters. |
channel | body | string | No | Payment Merchant list support. Value range: alipay: Alipay Wallet. alipayplus: Alipay+ Wallet. Country support only Japan. wechat: Wechat Wallet. linepay: Rabbit LINE Pay Wallet. Country support only Thailand. airpay: Shopeepay Wallet. Country support only Thailand. truemoney: TrueMoney Wallet. Country support only Thailand. atome: Atome Buy now pay later. minimum of 20 Baht. Country support only Thailand. promptpay: PromptPay QR code (Thailand standard bank transfer QR code). Country support only Thailand. scb_easy: SCB EASY Mobile App. minimum of 20 Baht. (only support on mobile). Country support only Thailand. bbl_deeplink: Bualuang mBanking Mobile App. minimum of 20 Baht. (only support on mobile). Country support only Thailand. baybank_deeplink: KMA Krungsri Mobile App. minimum of 20 Baht. (only support on mobile). Country support only Thailand. kplus: KPLUS. minimum of 20 Baht. (only support on mobile). Country support only Thailand. card: Card Gateway. support Visa Card, Master Card, Union Pay Card, TPN Card. Country support only Thailand. ktc_instal: KTC Installment. support only KTC Card. minimum of 3,000 Baht. Country support only Thailand. kbank_instal: KBANK Installment. support only KBANK Card. minimum of 3,000 Baht. Country support only Thailand. kcc_instal: Krungsri Installment. support only Krungsri Card. minimum of 3,000 Baht.(5,000 Baht. for 10 months or more than). Country support only Thailand. kfc_instal: First Choice Installment. support only Krungsri First Choice Card. minimum of 3,000 Baht. Country support only Thailand. If multiple e-payment method required,a string made up by required e-wallets ,which seperated by "," without space, for example:"promptpay,linepay,airpay,truemoney,atome,card,ktc_instal,kbank_instal,kcc_instal,kfc_instal,scb_easy,bbl_deeplink,baybank_deeplink,kplus,alipay,wechat",card,ktc_instal,kbank_instal,kcc_instal,kfc_instal". will open all of channel your merchant you have. It will send Ksher checkout page to select your wallet want to paid. If you send only one channel, it will be redirected to each wallet you send. |
operator_id | body | string | No | operator_id number at cashier, using for merchant have muti level account or Cashier. For more information please check at Muti level account or Cashier |
lang | body | string | No | The display language. Value range: en: English. cn: Chinese. th: Thai. Default is en. |
member_id | body | string | No | User ID provided by merchant side.Gateway will bind user ID and credit card,and customers do not need to enter card info next time. Can’t use Real number like 1,1200,00001, please use string with number like ABC1234. |
signature | body | string | Yes | Request signature |
#
Request body example#
Response resultWhen the error_code is SUCCESS, the order creation is successful, and the interface returns the order details
reference is the payment address or the order number of the corresponding payment channel
#
Successful response example#
Example of response failure (duplicate order number)#
Checking order#
Checking order APIURL | /api/v1/redirect/orders/{order_id} |
---|---|
Method | GET |
Accept | application/json |
#
Checking order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
mid | query | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
provider | query | string | No | Payment gateway |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Checking order Request example#
Checking order Response resultThe query order can be combined with the scene to judge the error_code to confirm the result, such as the unpaid order, the response error_code is "PENDING"
#
Checking order Successful response example#
Refund order#
Refund order APIURL | /api/v1/redirect/orders/{order_id} |
---|---|
Method | PUT |
Content-Type | application/json |
#
Refund order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
#
Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
refund_order_id | body | string | Yes | Unlimited format, unique refund order number used by merchant |
signature | body | string | Yes | Request signature |
timestamp | body | string | Yes | Timestamp |
refund_amount | body | number | Yes | The refund amount, cents, cannot be greater than the order amount, only partial payment channels support non-full refunds. |
provider | body | string | No | Payment gateway |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
#
Request body example#
Response resultThe refund interface returns the refund result synchronously. If the refund is successful, the interface returns the order details, and the error_code is "REFUNDED".
#
Successful response example#
provider and channel supportWhen creating an order, you can choose provider and channel to choose the payment channel. Each provider has several channels that can be selected.
When creating a redirect order, the optional values of provider and channel are as follows
Channel Payment Support Each country
#
Cancel orderCancel order will close link payment to allow customer access to pay after send API. If customer save QR to their local device. Customer still can make payment.
#
Cancel order APIURL | /api/v1/redirect/orders/{order_id} |
---|---|
Method | DELETE |
Content-Type | application/json |
#
Cancel order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
#
Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
signature | body | string | Yes | Request signature |
timestamp | body | string | Yes | Timestamp |
provider | body | string | No | Payment gateway |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
#
Request body example#
Response resultThe refund interface returns the refund result synchronously. If the refund is successful, the interface returns the order details, and the error_code is "REFUNDED".
#
Successful response example#
3. Mini program payment#
Specifications of APIs#
Steps for WeChat Pay miniprogram integration- Merchants register on Ksher system as an ONLINE merchant and pass the audit to obtain the Ksher merchant number.
- Merchants need to register on the WeChat open platform (https://open.weixin.qq.com/) to obtain the certification and mini-program’s WeChat APPID and registration name(should be same as bussiness registration certificate).
- Merchant obtains Ksher APPID and Private key from Ksher merchant platform https://merchant.ksher.net/big_business/index;
- Merchant need to tell Ksher WeChat mini-program APPID and Verified Entity Name for Ksher to Apply for Wechat App Pay binding.
- Merchants use MINI-PROGRAM_PAY API to access integrated development.
#
Create Order#
Create Order APIURL | /api/v1/miniapp/orders |
---|---|
Method | POST |
Content-Type | application/json |
#
Create Order Request parameter#
Create Order Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
merchant_order_id | body | string | Yes | The unique order number used by the merchant |
amount | body | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
channel | body | string | No | Payment channel , Value range: alipay: Alipay Wallet. alipayplus: Alipay+ Wallet. Country support only Japan. wechat: Wechat Wallet. |
miniapp_openid | body | string | No | The openid of the applet user, the WeChat applet is openid |
miniapp_appid | body | string | No | The appid of the Mini Program |
timestamp | body | string | No | Timestamp |
note | body | string | No | order notes |
signature | body | string | Yes | Request signature |
#
Request body example Create WeChat Mini Program order#
Request body example Create Alipay applet order#
Response result- When the error_code is SUCCESS, the order creation is successful, and the interface returns the order details
#
Additional fields for order details when creating WeChat Mini Program ordersName | Types | Required | instruction |
---|---|---|---|
reference | string | Yes | The package field of WeChat applet payment parameters |
reserved1 | string | Yes | The timeStamp field of the WeChat applet payment parameter |
reserved2 | string | Yes | The signType field of the WeChat applet payment parameter |
reserved3 | string | Yes | paySign field of WeChat applet payment parameters |
reserved4 | string | Yes | The nonceStr field of the WeChat applet payment parameter |
Use the above fields to initiate payment in the WeChat Mini Program, refer to https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html
#
Successful response example#
Additional fields for order details when creating an Alipay applet orderName | Types | Required | instruction |
---|---|---|---|
reference | string | Yes | The orderStr field of Alipay applet payment parameters |
Use the above fields to initiate payment in the Alipay applet, reference https://opendocs.alipay.com/mini/api/openapi-pay
#
Successful response example#
checking order#
APIURL | /api/v1/miniapp/orders/{order_id} |
---|---|
Method | GET |
Accept | application/json |
#
Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
mid | query | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Request example#
Response result#
Successful response example#
Refund order#
Refund order APIURL | /api/v1/miniapp/orders/{order_id} |
---|---|
Method | PUT |
Content-Type | application/json |
#
Refund order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
#
Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
refund_order_id | body | string | Yes | Unlimited format, unique refund order number used by merchant |
signature | body | string | Yes | Request signature |
timestamp | body | string | Yes | Timestamp |
refund_amount | body | number | Yes | The refund amount, cents, cannot be greater than the order amount, only partial payment channels support non-full refunds |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
#
Request body example#
Response result#
Successful response example#
4. App payment#
Specifications of APIs#
Steps for WeChat APP Pay integration- Merchant register on Ksher system as an ONLINE merchant and pass the audit to obtain the Ksher merchant number
- Merchant need to register on the WeChat open platform (https://open.weixin.qq.com/) to obtain the certification and APP’s WeChat_APPID
- Merchant obtains Ksher_APPID and key from Ksher merchant platform https://merchant.ksher.net/big_business/index
- Merchant need to tell Ksher WeChat _APPID and Verified Entity Name for Ksher to Apply for Wechat App Pay binding.
- Merchant use APP_pay to access integrated development.
- On the merchant side, WeChat Pay open SDK(for Android/iOS https://pay.weixin.qq.com/wiki/doc/api/wxpay/ch/pages/In-AppPay.shtml ) integrated into the mobile app.
- After completing above steps, call Ksher App Pay API to complete transactions.
#
Steps for Alipay APP Pay integration- Merchant register on Ksher system as an ONLINE merchant and pass the audit to obtain the Ksher merchant number
- Register on https://opendocs.alipay.com/open/54/104509 to get the Alipay APPID
- Merchant obtains Ksher_APPID and key from Ksher merchant platform https://merchant.ksher.net/big_business/index
- Merchants submit Alipay APPID to ksher for Alipay filing.
- Merchant use APP_PAY API to access integrated development.
- On the merchant side, Alipay open SDK(for Android/iOS https://opendocs.alipay.com/open/200 ) integrated into the mobile app.
- After completing above steps, call Ksher App Pay API to complete transactions.
#
Create Order#
App payment Create Order APIURL | /api/v1/app/orders |
---|---|
Method | POST |
Content-Type | application/json |
#
App payment Create Order Request parameter#
App payment Create Order Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
merchant_order_id | body | string | Yes | The unique order number used by the merchant |
amount | body | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
channel | body | string | No | Payment Merchant list support. Value range: alipay: Alipay Wallet. alipayplus: Alipay+ Wallet. Country support only Japan. wechat: Wechat Wallet. linepay: Rabbit LINE Pay Wallet. Country support only Thailand. airpay: Shopeepay Wallet. Country support only Thailand. |
app_appid | body | string | No | The app_id of the mobile application, such as the app_id of the mobile application of the WeChat open platform, the application method Reference |
timestamp | body | string | No | Timestamp |
note | body | string | No | order notes |
signature | body | string | Yes | Request signature |
#
Request body example Create Alipay order#
Response result- When the error_code is SUCCESS, the order creation is successful, and the interface returns the order details
#
Additional fields for order details when creating an Alipay orderName | Types | Required | instruction |
---|---|---|---|
reference | string | Yes | The orderStr field of Alipay app payment parameters |
Use the above fields to call up Alipay App payment through the payment SDK
#
Successful response example#
Checking order#
Checking order APIURL | /api/v1/app/orders/{order_id} |
---|---|
Method | GET |
Accept | application/json |
#
Checking order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
mid | query | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Request example#
Response result#
Successful response example#
Refund order#
Refund order APIURL | /api/v1/app/orders/{order_id} |
---|---|
Method | PUT |
Content-Type | application/json |
#
Refund order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
#
Refund order Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
refund_order_id | body | string | Yes | Unlimited format, unique refund order number used by merchant |
signature | body | string | Yes | Request signature |
timestamp | body | string | Yes | Timestamp |
refund_amount | body | number | Yes | The refund amount, cents, cannot be greater than the order amount, only partial payment channels support non-full refunds |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
#
Request body example#
Refund order Response result#
Successful response example#
5. C scan B payment#
Create Order#
APIURL | /api/v1/cscanb/orders |
---|---|
Method | POST |
Content-Type | application/json |
#
Request parameter#
Body parametername | Location | Types | required | instruction |
---|---|---|---|---|
merchant_order_id | body | string | Yes | The unique order number used by the merchant |
amount | body | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
note | body | string | No | order notes |
timestamp | body | string | Yes | Timestamp |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
provider | body | string | No | Payment gateway, optional values ('th','ph','my') |
channel | body | string | Yes | Payment Merchant support. Value range: alipay: Alipay Wallet. alipayplus: Alipay+ Wallet. Country support only Japan. wechat: Wechat Wallet. airpay: Shopeepay Wallet. promptpay:PromptPay QR code (Thailand standard bank transfer QR code). truemoney: TrueMoney Wallet. |
device_id | body | string | No | terminal id from which the request is sent, assigned by merchant. |
operator_id | body | string | No | operator_id number at cashier, using for merchant have muti level account or Cashier. For more information please check at Muti level account or Cashier |
signature | body | string | Yes | Request signature |
note
Please check Channel Payment Support Each country before using API. nomally if you want to use all of wallet , have to use muti-mid
#
Request body example#
Response resultWhen the error_code is SUCCESS, the order creation is successful, and the interface returns the order details
reference is the payment address or the order number of the corresponding payment channel
#
Successful response example#
Response failure example#
Expire time QR on C scan B API#
BBL PromptPay- can setup time wallet -> No
- expire_time min -> can't setup
- expire_time max -> can't setup
- default time expire_time, If merchant leave value expire_time -> never expire
#
SCB PromptPay- can setup time wallet -> Yes, at expire_time
- expire_time min -> 0
- expire_time max -> unlimited depend on customer
- default time expire_time, If merchant leave value expire_time -> 1 day
#
Truemoney- can setup time wallet -> Yes, at tmn_expire_time
- expire_time min -> 0
- expire_time max -> unlimited depend on customer
- default time expire_time, If merchant leave value tmn_expire_time -> 1 day
#
Alipay- can setup time wallet -> No
- expire_time min -> can't setup
- expire_time max -> can't setup
- default time expire_time, If merchant leave value expire_time -> 3 hours
#
Wechat- can setup time wallet -> No
- expire_time min -> can't setup
- expire_time max -> can't setup
- default time expire_time, If merchant leave value expire_time -> 2 hours
#
Shopeepay- can setup time wallet -> No
- expire_time min -> can't setup
- expire_time max -> can't setup
- default time expire_time, If merchant leave value expire_time -> 1 month
#
Checking order#
Checking order APIURL | /api/v1/cscanb/orders/{order_id} |
---|---|
Method | GET |
Accept | application/json |
#
Checking order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
mid | query | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
provider | query | string | No | Payment gateway |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Checking order Request example#
Checking order Response result#
Checking order Successful response example#
Refund order#
Refund order APIURL | /api/v1/cscanb/orders/{order_id} |
---|---|
Method | PUT |
Content-Type | application/json |
#
Refund order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
#
Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
refund_order_id | body | string | Yes | Unlimited format, unique refund order number used by merchant |
signature | body | string | Yes | Request signature |
timestamp | body | string | Yes | Timestamp |
refund_amount | body | number | Yes | The refund amount, cents, cannot be greater than the order amount, only partial payment channels support non-full refunds. |
provider | body | string | No | Payment gateway |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
#
Request body example#
Response result#
Successful response example#
6. B scan C payment#
Create Order#
APIURL | /api/v1/bscanc/orders |
---|---|
Method | POST |
Content-Type | application/json |
#
Request parameter#
Body parametername | Location | Types | required | instruction |
---|---|---|---|---|
merchant_order_id | body | string | Yes | The unique order number used by the merchant |
amount | body | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
auth_code | body | string | Yes | The Authentication code generated from eWallet of the consumer |
note | body | string | No | order notes |
timestamp | body | string | Yes | Timestamp |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
provider | body | string | No | Payment gateway, optional values ('th','ph','my') |
channel | body | string | Yes | Payment Merchant support. Value range: alipay: Alipay Wallet. alipayplus: Alipay+ Wallet. Country support only Japan. wechat: Wechat Wallet. Country support only Japan. linepay: Rabbit LINE Pay Wallet. Country support only Japan. airpay: Shopeepay Wallet. Country support only Thailand. truemoney: TrueMoney Wallet. Country support only Thailand. |
device_id | body | string | No | terminal id from which the request is sent, assigned by merchant. |
operator_id | body | string | No | operator_id number at cashier, using for merchant have muti level account or Cashier. For more information please check at Muti level account or Cashier |
signature | body | string | Yes | Request signature |
#
Request body example#
Response resultWhen the error_code is SUCCESS, the order creation is successful, and the interface returns the order details
reference is the payment address or the order number of the corresponding payment channel
#
Successful response example#
Response failure example#
QR format each wallet#
TrueMoneyTruemoney have total of 14 numbers, the first two digits start with "00". Example 00002727475523
#
LINE PayLINE Pay have total of 12 numbers. Example 3486 6978 2883
#
ShopeepayShopeepay has a total of 20 characters (letters + numbers), the first 4 digits will start with "APTH" Example APTH 8091458996703410
#
AlipayAlipay 16-25 digits and start with '25', '26', '27', '28', '29', and '30'.
#
WeChat PayWeChat Pay has 18 numbers, starting with "13".
#
Checking order#
Checking order APIURL | /api/v1/bscanc/orders/{order_id} |
---|---|
Method | GET |
Accept | application/json |
#
Checking order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
mid | query | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
provider | query | string | No | Payment gateway |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Checking order Request example#
Checking order Response result#
Checking order Successful response example#
Refund order#
Refund order APIURL | /api/v1/bscanc/orders/{order_id} |
---|---|
Method | PUT |
Content-Type | application/json |
#
Refund order Request parameterName | Location | Types | Required | instruction |
---|---|---|---|---|
order_id | path | string | Yes | The unique order number used by the merchant (merchant_order_id when creating the order) |
#
Body parametersName | Location | Types | Required | instruction |
---|---|---|---|---|
refund_order_id | body | string | Yes | Unlimited format, unique refund order number used by merchant |
signature | body | string | Yes | Request signature |
timestamp | body | string | Yes | Timestamp |
refund_amount | body | number | Yes | The refund amount, cents, cannot be greater than the order amount, only partial payment channels support non-full refunds. |
provider | body | string | No | Payment gateway |
mid | body | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
#
Request body example#
Response result#
Successful response example#
7. Interface returns field detailsCreate an order, query an order, initiate a refund, after the request is successful, the detailed information returned by the interface, the field description is as follows
Name | Types | Required | instruction |
---|---|---|---|
status | string | Yes | The current status of the order |
id | string | Yes | Internal unique id |
currency | string | Yes | Currency code of the order. refer to with ISO 4217. |
amount | number | Yes | How much to charge. add 00 for decimal.Example 150.50 THB amount =15050 |
note | string | Yes | Order remarks information |
reference | string | Yes | The payment link to be used for making payment |
error_code | string | Yes | Response code returned by the interface |
error_message | string | Yes | Information corresponding to the error_code response code returned by the interface instruction |
timestamp | string | Yes | Timestamp |
signature | string | Yes | Signature of response content |
api_name | string | Yes | API category requested |
order_type | string | Yes | Order type, normal sales order or refund order |
acquirer | string | Yes | Acquirer for current order |
gateway_order_id | string | Yes | Gateway order number. |
merchant_order_id | string | Yes | The order number used by the merchant |
acquirer_order_id | string | No | Acquirer’s order number, the uniq string used to identify the order on the acquirer’s side |
channel_order_id | string | No | The order number on the payment channel side, used to identify the order on the payment channel side |
channel | string | No | Order payment channel |
order_date | string | No | The date of the order |
mid | string | No | The merchant ID of this order is only valid when there are multiple sub-merchants under the same account. |
reserved1 | string | No | Misc Field 1 |
reserved2 | string | No | Misc Field 2 |
reserved3 | string | No | Misc Field 3 |
reserved4 | string | No | Misc Field 4 |
locked | boolean | No | Indicates whether the order has been locked for customs clearance and settlement. |
force_clear | boolean | No | Whether to force the transaction to participate in the reconciliation |
cleared | boolean | No | Indicates whether the transaction has been cleared |
#
The legal status of the order detailsValue | Description | Create Order | Query Order | Initiate Refund |
---|---|---|---|---|
Available | To be paid | ✔ | ✔ | - |
Failed | Failed | ✔ | ✔ | - |
Closed | closed | ✔ | ✔ | - |
Paid | Paid | ✔ | ✔ | - |
Refunded | Partial refund/full refund | ✔ | ✔ | - |
Voided | Revoked | - | - | - |
Cancelled | Cancelled | - | - | - |
Authorized | Pre-authorization | - | - | - |
Release | Pre-authorization completed | - | - | - |
#
Interface error_code legal valueValue | Description | Create Order | Query Order | Initiate Refund |
---|---|---|---|---|
SUCCESS | Successfully created an order | ✔ | ✔ | - |
DUPLICATED | Successfully created an order | ✔ | ✔ | - |
FAIL | Failed | ✔ | ✔ | ✔ |
NOTPAY | Order not paid Buyer reject pay for one channel | - | ✔ | ✔ |
PENDING | Order pending payment | - | ✔ | - |
REFUNDED | Full or partial refund of the order. | - | ✔ | ✔ |
INVALID_REFUND_BALANCE | The refund amount is incorrect (the refund amount exceeds the order refundable amount) | - | - | ✔ |
NOTFOUND | Order not found or does not exist | - | ✔ | ✔ |
NOTPAID | Order not paid | - | ✔ | ✔ |
NOTSUPPORTED | The operation is not supported | - | ✔ | ✔ |
SIGNERROR | Verify signature error | ✔ | ✔ | ✔ |
PROVIDERERROR | Provider is wrong | ✔ | ✔ | ✔ |
PROVIDERCLOSE | The current merchant does not support the Provider | ✔ | ✔ | ✔ |
DEBUG | Signature debug mode, in this mode, the returned reference field is the correct signature, and the note field is the original data before signing | ✔ | ✔ | ✔ |
#
8. Report API#
Channels availablequery the information of the channel you have joined up.
#
APIURL | /api/v1/finance/settlements/channels |
---|---|
Method | GET |
Accept | application/json |
#
Request parameter#
path parametername | Location | Types | required | instruction |
---|---|---|---|---|
mid | query | string | Yes | the mid of the request. |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Request URL example#
Response resultSuccessful response example
#
Transaction dataTransaction report is mean all of transection (Paid/Notpaid/On processes/refund etc). for merchant can check what is current status /Dashboard.
#
APIURL | /api/v1/finance/settlements/order/{yyyymmdd} |
---|---|
Method | GET |
Accept | application/json |
#
Request parameter#
path parametername | Location | Types | required | instruction |
---|---|---|---|---|
yyyymmdd | path | string | Yes | The year, month and day to be queried, such as 20210803 |
channel | query | string | No | the channel you want to query, don't send this param if you want to query all. |
limit | query | string | Yes | data size one time, must less than 50 |
mid | query | string | Yes | the mid of the request. |
offset | query | string | Yes | Data Offset |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Request URL example#
Response resultSuccessful response example
#
Create Settlement dataSettlement report is mean report ksher already tranfer cash to merchant. It will only display transaction ksher tranfer to merchant.
Create Settlement data for check detail next step
#
APIURL | /api/v1/finance/settlements/{yyyymmdd} |
---|---|
Method | GET |
Accept | application/json |
#
Request parameter#
path parametername | Location | Types | required | instruction |
---|---|---|---|---|
yyyymmdd | path | string | Yes | The year, month and day to be queried, such as 20210803 |
channel | query | string | Yes | the channel need to query, you should query one by one |
mid | query | string | Yes | the mid of the request. |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Request URL example#
Response resultSuccessful response example
#
Settlement orderSettlement report is mean report ksher already tranfer cash to merchant. It will only display transaction ksher tranfer to merchant.
query the information of the settlement need to use response from 8. Settlement data acquisition
#
APIURL | /api/v1/finance/settlements/settlement_order |
---|---|
Method | GET |
Accept | application/json |
#
Request parameter#
path parametername | Location | Types | required | instruction |
---|---|---|---|---|
reference_id | path | string | Yes | reference id get from Create Settlement data API |
limit | query | integer | Yes | data size one time, must less than 50, default=50 |
offset | query | integer | Yes | Data Offset, default=0 |
signature | query | string | Yes | Request signature |
timestamp | query | string | Yes | Timestamp |
#
Request URL example#
Response resultSuccessful response example
#
9. WebHookThe webhook callback address can be configured in the background of the gateway payment gateway
When the order status changes, the payment gateway will send a GET request to the webhook address with the following parameters
Parameter name | Types | Description |
---|---|---|
type | string | Event Types, fixed value "order" |
instance | string | Merchant side order number, that is, the merchant_order_id field |
code | string | Event code, fixed value "statuschange" |
message | string | Order status changes |
signature | string | Request signature |
The request can be signed and verified through the signature rule, and the apiUrl in the signature rule uses the full address of the webhook
If the webhook address response is 200, the notification is successful, otherwise the notification will be repeated, repeated every 5 seconds, at most 6 times
When receiving the webhook notification, the parameters need to be verified. For the verification process, please refer to the signature calculation section below.
Note the signature is used for you to validate the web hook is actually come from the Payment Gateway or not. you should validate the signature using the same algorithm as other API call.
#
messagemessage field value
value | instruction |
---|---|
Order Timeout | Order timeout |
Order Closed | Order closed |
Order Paid | Order Paid |
Order Refunded | Order partial refund/full refund |
#
Webhook notification exampleURL | webhook address |
---|---|
Method | GET |
#
Request content#
Example in Query string#
Example in PostmanNote the signature is used for you to validate the web hook is actually come from the Payment Gateway or not. you should validate the signature using the same algorithm as other API call.
#
Test a webhook endpointIf you don't have public url you can setup Webhook URL to send some test webhook like https://webhook.site
or you can read info about Test WebHook registration with request logging site from Microsoft.
#
10. Signature calculationGateway API will verify every API request, so every HTTP request must include signature information, and requests with invalid signatures will return an error
The gateway API passes the token verification request set in the payment background. The token can be used to produce the signature field in the HTTP request, which needs to be strictly confidential.
The token can be obtained or reset in the following locations:
If you manually write HTTP requests instead of using the official SDK, you need to understand the signature algorithm
#
Signature algorithmThe process of generating a signature is as follows
#
1. Sort all request parameters (except the signature field) according to the parameter name in the ASCII table. For example:#
2. Concatenate the sorted parameters and their values into a string. For example:#
3. Add the API name before the spliced string, take the creation of the order interface as an example "/api/v1/redirect/orders"#
4. Encode the string in UTF-8 format, and use the HMAC_SHA256 signature algorithm for digest, the secret key is the token in the background configuration aboveHere is a demonstration of a third-party encryption tool, you can use the third-party tool library according to the development language to achieve HMAC_SHA256 signature
#
webhook verify signatureWhen calculating the webhook signature, the API name is the full url of the webhook address, and the other steps are the same
Note that when the parameters are spliced into strings, the signature field must be excluded before splicing
If the final signature value is consistent with the signature in the request received by webhook, the verification is successful