Order Close

API method

URL

https://api.mch.ksher.net/KsherPay/order_close

Method

POST

Parameter organization format

application/x-www-form-urlencoded

Order Close Request Parameters

Parameter Type Required Example Description

appid

String(32)

YES

mch12345

Your Merchant Number. Check on merchant ksher. The format is mch{Merchant No}.

nonce_str

String(32)

YES

ae0e6jm55qlq1o7

Random string, must be unique for signature.

sign

String(256)

YES

b000e9b6ec3fbda482d96a3d7c75c6956a5864336c3098462525e7229e8e046e490939a3e8b320a6c68eb63795a25b79d8c74f042f0972039bb5fe9b861cefb4

To verify the accuracy of the request message, please refer to the signature creation method in the section Signature Creation.

channel

String(32)

YES

wechat

Value range:

  • airpay

  • wechat

  • alipay

  • alipayplus :only japan merchant

  • ktbcard

mch_order_no

String(32)

YES

order number on merchant side, must be unique

ksher_order_no

String(32)

YES

Order no. generated by Ksher.

channel_order_no

String(32)

YES

Order no. generated by payment channel(wechat, alipay etc.) Note: Not all these three parameters(mch_order_no, ksher_order_no, channel_order_no) are needed to provide at one time, but at least one should be provided.

time_stamp

String(256)

YES

time stamp example: "time_stamp": "20190622131804"

Example 1. Request Example
{
    "code": 0,
    "data": {
        "appid": "mch36591",
        "mch_order_no": "test3",
        "nonce_str": "7a57e84495bfe7abff4ff23591516511",
        "result": "SUCCESS"
    },
    "msg": "ok",
    "sign": "61805f39c7c484d936cbf40c864b11b9fec0b93205fdbc4efe5b71c9c7dfd98152e1ebc9af5866dd54cf58008418b52ea6122e7994f1d3fe5e6d559a8b022e5f",
    "status_code": "",
    "status_msg": "",
    "time_stamp": "2020-12-25T17:44:54.226116+08:00",
    "version": "3.0.0"
}

Order Close SUCCESS Response Parameters

Parameter Type Required Example Description

code

int

YES

0

code msg:

  • 0: it only shows the calling of the API is successful, not meaning the target business operation succeed.

  • Not 0: Calling of the API failed, merchant can use the same parameter to launch the request again.

sign

String(256)

YES

b000e9b6ec3fbda482d96a3d7c75c6956a5864336c3098462525e7229e8e046e490939a3e8b320a6c68eb63795a25b79d8c74f042f0972039bb5fe9b861cefb4

To verify the accuracy of this response, please refer to the method outlined in the section Verify Signature.

msg

String(32)

YES

the response message.

status_code

int

YES

  • 0: it only shows the calling of the API is successful, not meaning the target business operation succeed.

  • Not 0: Calling of the API failed, merchant can use the same parameters to launch the request again.

status_msg

String(256)

NO

the status message

time_stamp

String(256)

YES

"20190622131804"

time stamp

version

String(32)

YES

"3.0.0"

API version

data Parameters (JSON )

appid

String(32)

YES

mch35000

Your Merchant Number. Check on how to find your appid/Merchant No.. The format is mch{Merchant No}.

mch_order_no

String(32)

YES

generated by merchant self, it must be unique on the merchant side, same as the input.

nonce_str

String(32)

YES

Random string

result

string(16)

YES

SUCCESS

Value range: SUCCESS

Example 2. SUCCESS Response Example
{
    "code": 0,
    "data": {
        "appid": "mch36591",
        "mch_order_no": "test3",
        "nonce_str": "7a57e84495bfe7abff4ff23591516511",
        "result": "SUCCESS"
    },
    "msg": "ok",
    "sign": "61805f39c7c484d936cbf40c864b11b9fec0b93205fdbc4efe5b71c9c7dfd98152e1ebc9af5866dd54cf58008418b52ea6122e7994f1d3fe5e6d559a8b022e5f",
    "status_code": "",
    "status_msg": "",
    "time_stamp": "2020-12-25T17:44:54.226116+08:00",
    "version": "3.0.0"
}

Order Query Fail Response Parameters

Parameter Type Required Example Description

code

int

YES

0

Value Range:

  • 0: it only shows the calling of the API is successful, not meaning the target business operation succeed.

  • Non 0: Calling of the API failed, merchant can use the same parameters to launch the request again.

sign

String(256)

YES

b000e9b6ec3fbda482d96a3d7c75c6956a5864336c3098462525e7229e8e046e490939a3e8b320a6c68eb63795a25b79d8c74f042f0972039bb5fe9b861cefb4

To verify the accuracy of this response, please refer to the method outlined in the section Verify Signature.

msg

String(32)

YES

the response message.

status_code

int

YES

  • 0: it only shows the calling of the API is successful, not meaning the target business operation succeed.

  • Non 0: Calling of the API failed, merchant can use the same parameters to launch the request again.

status_msg

String(256)

NO

the status message

time_stamp

String(256)

YES

"20190622131804"

time stamp

version

String(32)

YES

"3.0.0"

API version

data Parameters (JSON )

result

string(16)

YES

FAIL

Value range: FAIL, NOTSURE.

  • FAIL : failed to close,in this case, merchant should re-launch the close request.

  • NOTSURE: it is not sure if the close operation succeed.

err_code

String(32)

YES

SYSTEMERROR

Refer to the error list for the details

err_msg

String(128)

YES

system error

the detailed description of the error

nonce_str

String(32)

YES

Random string

Example 3. Fail Response Example
{
    "code": 0,
    "data": {
        "err_code": "KSHER_INVALID_ORDER_NO",
        "err_msg": "failed to find this order no ('mch_order_no:test33,ksher_order_no:,channel_order_no:',).",
        "nonce_str": "7a57e84495bfe7abff4ff23591516511",
        "result": "FAIL"
    },
    "msg": "ok",
    "sign": "01d2436ef5ed44cb77d3594adccc2c92e2a6a8b39cad2bd1abc3dcd9d64b7c00a303355fc47cb61c3862fb116ed7f67b9db73634da95e91a1fcfc6b12a96da59",
    "status_code": "",
    "status_msg": "",
    "time_stamp": "2020-12-25T17:55:25.248752+08:00",
    "version": "3.0.0"
}