BTSE
Login
Docs
Introduction

Introduction

Welcome to the Pay API

The Pay API aim to create a payment gateway for online merchants. With Pay API, you will be able to accept cryptocurrencies and traditional payment such as credit card. We strongly suggest you to contact us before using it as we can help you understand which APIs you need in your scenarios. Feel free to try it out. Please don't hesitate to contact us if you have any queries.

Download Postman Collection with Demo Account

You will be able to access Pay API endpoints with the demo account in the postman collection. The credential of demo account are all set in collection variables. Please change them when you receive your own staging credential.

As we have to set webhook domain for each account, you will be able to check webhook data in Webhook.site - Test, process and transform emails and HTTP requests

Secure API Invocation

To allow API invocations are secured between two channels, we need to:

  • For staging and production environment, whitelist API servers' IPs
  • Send you two keys, `secret key and api key. Secret key is used in encryption of password or any sensitive value. API key would be send through http header.

How to Prepare HTTP Header

These parameters can help us verify who you are and make sure the consistency of requests.

Parameter NameData TypeExampleDescription
apistringThe API key we provide you.
noncestring1640313017000Representation of current unix timestamps in milliseconds
signstringA composite signature produced based on How to Prepare Signature

Please make sure that the unix timestamp should be sent to Pay API within 30 seconds after this timestamp has been generated.

How to Prepare Signature

Algorithm

We use HMAC.SHA384 algorithm to generate signatures.

Parameters Used for Generating Signatures

KeyData TypeExampleDescription
secret keystringxxxxxxxxxThe secret key we provide you.
urlstring/payment/pay-api/v1/public/rateWhich API url you are going to access

| | nonce | string | 1640313017000 | current unix timestamps in milliseconds | |request body | JSON string | | As it might send requests with different content type, to determine how to prepare it, please refer to Content-Type: application/json |

Content-Type: application/json

  • The order of parameters is NOT important.

Calculate for POST method:

url: /payment/pay-api/v1/deposit/fiat
request-nonce: 1640313017000
request body: {"referenceId":"localtest001","email":"localtest001@mail.com","firstName":"John","lastName":"Doe","country":"US","currency":"USD","amount":30,"clientOrderId":"abc63cc3-5315-43ee-b6d3-c90205734a4e","redirectUrl":"https://www.google.com","extra":"hanktest"}
 
sign: HMAC.SHA384(secretKey, (url+nonce+body))
= HMAC.SHA384('xxxxxxxxx', '/payment/pay-api/v1/deposit/fiat1640313017000{"referenceId":"localtest001","email":"localtest001@mail.com","firstName":"John","lastName":"Doe","country":"US","currency":"USD","amount":30,"clientOrderId":"abc63cc3-5315-43ee-b6d3-c90205734a4e","redirectUrl":"https://www.google.com","extra":"hanktest"}')
= dcba18a9542333c1b89d1ed6d21c9dc12e260ee9f284fb2dd12efb87f53d12979a8566316068e24289d1c4e8e83273aa

Calculate for GET method:

url: /payment/pay-api/v1/public/rate
request-nonce: 1640313017000
 
sign: HMAC.SHA384(secretKey, (url+nonce+body))
= HMAC.SHA384('xxxxxxxxx', '/payment/pay-api/v1/public/rate1640313017000')
= 0784690d0d4df39303c06c6dede49415ce5dd0e884b40a43a64eb151af92dc452b91c00fe888215c51c1f9f7ece856d7

Content-Type: multipart/form-data

Calculate for POST method:

As we need to make sure the plain texts used to calculate by you and us are the same, here you will need to order all Text parameters alphabetically and then change it to JSON string.

For instance, there are several parameters of Upload User KYC files endpoints:

merchantUserId: 9485ee4c-4cc7-49f3-8b33-6542b9a92c73
firstName: Jane
lastName: Williams
email: test@gmail.com
idNumber: 1928310292
idType: 1
nationality: USA
idFileFront: <File in binary>
idFileBack: <File in binary>
selfie: <File in binary>

As the last 3 parameters are not Text, we transform these parameters into JSON string with alphabetical order, excluding last 3 file parameters.

{
  "email": "test@gmail.com",
  "firstName": "Jane",
  "idNumber": "1928310292",
  "idType": "1",
  "lastName": "Williams",
  "merchantUserId": "9485ee4c-4cc7-49f3-8b33-6542b9a92c73",
  "nationality": "USA"
}

Then remove blank in the JSON string and use it to calculate signature.

url: /payment/pay-api/v1/user/kyc/upload
request-nonce: 1640313017000
 
sign: HMAC.SHA384(secretKey, (url+nonce+body))
= HMAC.SHA384('xxxxxxxxx', '/payment/pay-api/v1/user/kyc/upload1640313017000{"merchantUserId": "9485ee4c-4cc7-49f3-8b33-6542b9a92c73","firstName": "Jane","lastName": "Williams","email": "test@gmail.com","idNumber": "1928310292","idType": "1","nationality": "USA"}')
= 3610fef1cc749f1d805671d38576cd80641ada4d46d0b6657f0b9754e86a3d04eca10adce5bff620aea5800920fc9067

Work Flows

Pay API service provides you solutions for accepting cryptocurrency and fiat. To understand the whole flows:

  • For integrating with crypto solution, please refer to Crypto Solution for further information.
  • For accepting fiat payment, please refer to Payment Solution for further information.

Error Codes from API

CodeDescription
11000004KYC info is needed. Please contact us.
11000007User hasn't bound 2FA.
11000008User 2FA check failed.
11000009User OTPCode check failed.
11000010User OTPCode not found.
11000011The user has no permission for the operation.
11000012Cannot find wallet.
11000013Insufficient Balance in Wallet.
11000017User residence country is empty.
11000019Incorrect crypto address.
11000024System coin settings error.
11000025Coin cannot be found.
11000029Unknown currency.
11000039Invalid Protocol.
11000042The user status is not activated.
11000043Do not support [%s] action.
11000046User ask OTP too frequently.
11000049Forbidden by system level.
11000061Amount is less than 0.
11000091The amount is invalid.
11000101The deposit amount is invalid.
11000102Country (%s) is not allowed to use the service.
11000104The number of addresses has reached the maximum available limit for creation.
11000200The withdraw amount is invalid.
11000202Wallet operation failed.
11000206Reached the KYC limit for crypto withdrawals.
11000305Service is not supported now.
11000400Single amount is too low.
11000401Single amount is too high.
11000402Reach amount limit.
11000403Reach txn time limit.
11090000Merchant authentication failed.
11090001Merchant User Error.
11090002Merchant Setting Error. Reason:
11090003Not Supported Request. Reason:
11090004Permission Denied With the Coin and Protocol.
11090005Duplicated reference id:
11090006User hasn't bound with current merchant.
11090007The merchantUserId has bound. Please provide userKey instead of merchantUserId.
11090008Amount should not be equals to or less than 0.
11090009Cannot find user.
11090010Over address number limitation.
11090011The amount is invalid.
11090012Insufficient balance.
11090020Duplicated client order id:
11090097Callback process failed:
11090098System error.
11090099Request parameters error. Reason: