Ksher Payment API Gateway for Developers

Number of APIs: 20

Ksher Payment API Gateway for Developers

Ksher will shut down the API connection via .vip.ksher.net. That make
new register merchant will unable to use system over .vip.ksher.net. If
you never integrate API with Ksher, Please to use
api.ksher.net

Enable ePayment for your Website and App via simple API
https://doc.vip.ksher.net

Introduction

Ksher API Gateway supports payment in multiple countries and multiple payment channels (different card schemes, wallets and offline channels). All countries and channels can be integrated using a unified API.

In the sale transaction process, the interaction between the merchant and the gateway is as follows:

  1. The merchant's website initiates a transaction through an API call, and the API request contains the following main information:
    • Amount
    • Successful transaction redirect url
    • Transaction failed redirect url
  2. The API gateway returns a payment link to the merchant website, and the merchant website redirects the consumer's browser (or the webview built in the mobile APP) to this payment link.
  3. The consumer visits the payment link and completes the payment.
  4. After the payment is successful, the API gateway sends a Webhook to the merchant's website, and at the same time redirects the consumer's browser to access the transaction successful redirect url in the first step request

The above figure is a sequence diagram of the interaction among consumers, merchant websites, API gateways, and wallets in a payment scenario.

API Spec

The Document for each API is in swagger format and located under your own integration gateway site. https://your_url.vip.ksher.net/api-docs

For your convenience, ksher has created a sandbox for merchants that don't have own portal, which can be tested here.

https://sandboxdoc.vip.ksher.net/api-docs

In case the merchant has obtained the portal from ksher, use the portal obtained for testing.

There are a number of API collections included.

  • redirect API is for Website and Mobile App integration.
  • settlement API is for checking the settlement information.
  • miniapp API is for WeChat and Alipay Mini-Program integration.
  • event API is for checking the events deliveried.
  • C scan B API is for C scan B(merchant present QR code) or Kiosk integration.
  • B scan C API is for B scan C(customer present QR code) or POS integration.

For normal integration, you will only need to check the redirect API.

Gateway interface integration guide

1. Interface description

Request URL

The 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 Code

When the http status code is 200, the response contains errorcode and errormessage 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 codeinstruction
200Success
400Request parameter format verification failed
401unauthorized
403Permission denied
404The requested resource does not exist

400 response example

{
    "code": 400,
    "name": "Bad Request",
    "description": "<p class='preserveHtml' class='preserveHtml'>BadRequest {'redirect_url': ['Not a valid URL.']}</p>",
    "log_entry_url": "https://dev.vip.ksher.net/web#action=153&view_type=form&model=rest.log&id=1254"
}

  1. redirect - redirect-creat new POST {{base_url}}/api/v1/redirect/orders

  2. Mini program - miniapp-creat new POST {{base_url}}/api/v1/miniapp/orders

  3. Mini program - miniapp-query GET {{base_url}}/api/v1/miniapp/orders/:order_id?signature={{signature}}&timestamp=1647228347

  4. b scan c - B scan C - create new POST {{base_url}}/api/v1/bscanc/orders

  5. report - Transaction data GET {{base_url}}/api/v1/finance/settlements/order/:date?signature={{signature}}&timestamp=1647228347&mid=mch35618&offset=0&limit=50

  6. redirect - redirect-refund PUT {{base_url}}/api/v1/redirect/orders/:order_id

  7. Mini program - miniapp-refund PUT {{base_url}}/api/v1/redirect/orders/:order_id

  8. app - app-creat new POST {{base_url}}/api/v1/app/orders

  9. app - app-query GET {{base_url}}/api/v1/app/orders/:order_id?signature={{signature}}&timestamp=1647228347

  10. app - app-refund PUT {{base_url}}/api/v1/app/orders/:order_id