INTRODUCTION

FYI: we are still updating it. But you can start integrating.

IMPORTANT NOTE

  • All merchants need to be registered with KESS first, then we’ll provide
    1. merchant id
    2. merchant secret key
    3. an api username
    4. and password
    5. RSA2 Certificate (a private key and a public key file). If you want to generate your own RSA2 certificate, you need to provide us with a private/public key for decryption.
  • All POST/PUT/PATCH APIs are required form sign (sign_type = RSA2 and sign params)!!!
  • All rest api required header
    1. merchant-id = (Your merchant id provide by KESS)
    2. merchant-secret-key = (Your merchant secret key provided by KESS)
  • By default, KESS will use your private key to decrypt sensitive fields when you call the api. So you need to use the public key to encrypt the fields.
  • You’ll see fields that need to be encrypted in the api).
  • So KESS doesn’t encrypt data for the response.
  • To sign
    1. Prepare post params for sign
      1. Remove empty value params
      2. Cleaned params and sort params key as ascending
      3. Build url query for the params ( no ? at the beginning and & at the end of the string)
      4. If the param’s value is an array, it must be encoded and put in [ ]
      5. The string will be used to pass to your RSA2 method to sign.
    2. Use your private key for RSA2 (in case KESS use your public key to decrypt)
    3. Set Encryption Mode to ENCRYPTION_PKCS1
    4. Set Signature Mode to SIGNATURE_PKCS1
    5. RSA encrypts the string content
    6. Do base64 encode for the encrypted string, then the bas64 string is our sign content.

(We have sample for php, you can check rsa2Sign() method in KESS_RSA.php)

LOGIN AS PARTNER FIRST TO USER OTHER API

POST : API_BASE_URL/login
  • user_name = (Your merchant api user name provided by KESS)
  • password = (Your merchant api password provided by KESS)

REQUEST:

{
"user_name": "user_name",
"password": "password"
}

RESPONSE:

Success
{
"success": true
"code": 200,
"message": "OK",
"data": {
"token": "THE_TOKEN_YOU_NEED_FOR_OTHER_REST"
"user": {
"id": 219
"avatar": "default.png"
"time_zone": null
"full_name": 219
"balance": 5206.235,
"wallet_ref": "CW2001-xxxxx"
}
}
}

RESPONSE:

FAILED
{
"success": false
"code": 400,
"message": "Bad Request",
"error": {
"user_name_password": [
"Invalid login user"
]
}
}

REQUEST DEPOSIT

POST : API_BASE_URL/do-action

REQUEST:

{
"service": "request_deposit",
"account_number": "089889079-00515"
"amount": 10,
"currency": "USD"
"out_trade_no": "26871120430891275"
}

RESPONSE:

Success
{
"success": true
"code": 200,
"message": "OK",
"data": {
"token": "051432b286dc91a328199d680c8aef18"
"name": "Test Deposit"
}
}

RESPONSE:

FAILED
{
"success": false
"code": 400,
"message": "Bad Request",
"error": {
"account_number": [
"Account number not found"
]
}
}

verify DEPOSIT

POST : API_BASE_URL/do-action

REQUEST:

{
"service": "verify_deposit",
"token": "051432b286dc91a328199d680c8aef18"
}

RESPONSE:

Success
{
"success": true
"code": 200,
"message": "OK",
"data": {
"transaction_status": "FAILED"
}
}

Query Check Transaction

POST : API_BASE_URL/do-action

REQUEST:

{
"service": "verify_deposit",
"out_trade_no": "26871120430891275898990979876990"
}

RESPONSE:

Success
{
"success": true
"code": 200,
"message": "OK",
"data": {
"transaction_date": "2020-10-05"
"reference": "26871120430891275898990979876990"
"total_amount": "2020-10-05"
"transaction_date": 10,
"Currency": "USD"
"status": "FAILED"
}
}