General
FastPay provides two environments so that partners can integrate into their systems:
Environment | Domain | Purpose |
---|---|---|
Production | https://payment.fastpay.finance | It is deployed for service payment customer. |
Sandbox | https://sandbox-payment-api.fastpay.finance | It is used for integrate process: Developing function, testing, debugging. |
APIs General Information
Every request which calls to FastPay APIs has to follow below contrainsts:
HTTP Request
For HTTP Request which was sent to FastPay, FastPay requires partners attach information into HTTP Header follow describe information inside under table.
Attribute | Mandatory | Data Type | Description |
---|---|---|---|
x-api-key | ✔️ | String | API Key is provided when partner integrates it. Access to https://portal.fastpay.finance page to get information. |
HTTP Response
When FastPay accepts and processing the request, FastPay will return the result to client with below informations:
Response Payload
Attribute | Mandatory | Data Type | Description |
---|---|---|---|
code | ✔️ | String | Request processing code: Refer to FastPay error code table for more detail |
message | ✔️ | String | Describe processing result, maybe use it for customer's view or debugging |
responseTime | ✔️ | String | FastPay response time (Timestamp - Miliseconds) |
detail | Json Object | Coressponding with each API will has different detail . Observe detail at APIs that you used. |
{
"code": "SUCCESS",
"responseTime": 1721724783723,
"message": "Success",
"detail": null
}
Response Status
Status Code | Description |
---|---|
200 OK | Indicates that the request has succeeded. |
400 Bad Request | The server could not understand the request due to incorrect syntax. The client should NOT repeat the request without modifications. |
403 Forbidden | Unauthorized request. The client does not have access rights to the content. Unlike 401, the client’s identity is known to the server. |
500 Internal Server Error | The server encountered an unexpected condition that prevented it from fulfilling the request. |
502 Gateway Timeout | The server is acting as a gateway and cannot get a response in time for a request. |
Signature
signature
is a string of characters that is generated from a given algorithm, that is used to check the correctness of data on data link between FastPay and Merchant's system. Using signature in order to make sure that data is not changed during exchange data processing of FastPay and Merchant happen.
When FastPay receives request FastPay will compare signature which was sent from partner with FastPay's one, request will be processed once both of signatures are matched, vise versa process will be denied.
For Merchant's side, when receive response or request to FastPay, merchant should verify signature before processing the response.
Instruction for creating signature
Step 1: Information
Configuration Information
Algorithm: HMAC_SHA512
SecretKey: NgaXAQRmoxdZfa6abzs7l21h0WTF47IV
x-api-key: MGMYZQq56yEMuD86L0wlf3l3FpqzzAT5
Here is SandBox's environment information, it's used for testing and integration purpose. In case you need to use your own information please use business account that is provided by FastPay.
Header Information
Attribute | Value | Description |
---|---|---|
x-api-key | MGMYZQq56yEMuD86L0wlf3l3FpqzzAT5 |
Json Example to Generate signature
var payload = {
"requestId": "a5ba514c-5698-4aa9-b9de-d385351f54cc",
"requestType": "createOrder",
"requestTime": 1721725275,
"orderId": "1721725275",
"accountId": "demouser",
"network": "BSC",
"type": "deposit",
"redirectUrl": "https://webhook.site/cd178d6d-17b8-4394-af9b-a9d58b1de161",
}
Step 2: Create signature:
All information from request/response parameters/payload to construct data string with structure format: key1=value1&key2=value2&key3=value3& ... keyN=valueN
Note: keys are arranged in order A-Z, if value is null then value is empty ("")
With key1 is parameter/payload name, value1 is corresponding value to key1, likewise key2, key3, ... to keyN
var params = accountId=demouser&network=BSC&orderId=1721725275&redirectUrl=https://webhook.site/cd178d6d-17b8-4394-af9b-a9d58b1de161&requestId=a5ba514c-5698-4aa9-b9de-d385351f54cc&requestTime=1721725275&requestType=createOrder&type=deposit
signature = HMAC_SHA512(params, secretKey)
//Result: 4d838ce8ba3b989d193a943c3cb7fd226c371d5deb20291327b58b944049b64f37d50393f7245ad288d09a5d3c3e5cbfb8b2fd9cfd7ea07b877c3bbad621fd45
Tips: You can use tool: https://tools.onecompiler.com/hmac-sha512 for data testing.
Step 3: Send a request to FastPay Server
curl --location 'https://payment.fastpay.finance/v1/api/order/create' \
--header 'x-api-key: MGMYZQq56yEMuD86L0wlf3l3FpqzzAT5' \
--header 'Content-Type: application/json' \
--data '{
"requestId": "a5ba514c-5698-4aa9-b9de-d385351f54cc",
"requestType": "createOrder",
"requestTime": 1721725275,
"orderId": "1721725275",
"accountId": "demouser",
"network": "BSC",
"type": "deposit",
"redirectUrl": "https://webhook.site/cd178d6d-17b8-4394-af9b-a9d58b1de161",
"lang": "en",
"signature": "4d838ce8ba3b989d193a943c3cb7fd226c371d5deb20291327b58b944049b64f37d50393f7245ad288d09a5d3c3e5cbfb8b2fd9cfd7ea07b877c3bbad621fd45"
}'