Ksher App_Pay API Documentation

Overview

This document describes how merchant or software company use Ksher App pay API. The target readers are R&D engineers, architects and other related integration engineers.

Applicable Cases

App pay is applicable for the payment inside wechat browser or wechat public account, which without the process of scanning the authorization code or QR code.

Payment Flow

Ksher App_Pay Request url

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

Request Method

Post

Request Format

application/x-www-form-urlencoded

Ksher App_Pay Order Request

- Request Parameters

Parameter Type Required Value Example Description
appid String(32) YES mch20163 appid is the merchant ID that authorised by Ksher
nonce_str String(32) YES "sQ8gfSpeeV5Ld8ulW9q7JxUnXSOiZ90Y" Random string
channel String(32) YES wechat Value range: wechat /alipay /linepay /airpay
sign String(256) YES the signature value of all above key/value pairs.
mch_order_no String(32) YES generated by merchant self, it must be unique on the merchant side.
local_total_fee Int YES 100 total amount of the order and it must be an integer, the unit is cent.
fee_type String(16) YES CNY comply with ISO 4217, 3 characters
channel_sub_appid String(32) NO appid of app. The parameter channel is required when its value is wechat
notify_url String(256) YES http://www.myweb.com/wepay/pay_notify the url to receive the asynchronous notification about the status of the payment from Ksher; If merchant leaves this field blank, then there will be no notification to send back to merchant.
redirect_url String(256) YES the url of payment result page, to which redirected from Ksher Payment Page.
product String(512) NO Product name etc. info can be put here.
attach String(127) NO any extra information can be added here.
device_id String(32) NO POS001 the terminal device id from which the request is issued.

-SUCCESS Response Parameters

Parameter Type Required Example Description
code int YES 0 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 refer to following relevant chapter for signature algorithm
result string(16) YES SUCCESS SUCCESS
appid String(32) YES appid is the merchant ID that authorised by Ksher
nonce_str String(32) YES "sQ8gfSpeeV5Ld8ulW9q7JxUnXSOiZ90Y" Random string
mch_order_no String(32) YES generated by merchant self, it must be unique on the merchant side.
ksher_order_no String(32) YES generated by Ksher
prepay_id String(64) YES wx201410272009395522657a690389285100 The prepay id return sign generated by WeChat is used in subsequent interface calls, which is valid for 2 hours.
notify_url String(256) YES http://www.myweb.com/wepay/pay_notify the url to receive the asynchronous notification about the status of the payment from Ksher; If merchant leaves this field blank, then there will be no notification to send back to merchant.
product String(512) YES Product name etc. info can be put here.
attach String(127) NO any extra information can be added here.

-FAIL Response Parameters

Parameter Type Required Example Description
code int YES 0 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 refer to following relevant chapter for signature algorithm
result string(16) YES FAIL Value range: FAIL, NOTSURE
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 "sQ8gfSpeeV5Ld8ulW9q7JxUnXSOiZ90Y" Random string