Qashier Open API is a RESTful API that allows you to integrate your application with Qashier's payment terminal.
We check the timestamp
field(in seconds) in the request body or query parameters to validate the request.
The timestamp must be within 10 minutes of the server's current time, or the request will be rejected.
If it's a POST or PUT request, we get the timestamp
from the request body.
For the request of other methods, we get the timestamp
from the query parameters.
For security reasons, we validate the IP address of the request against the partner's IP whitelist.
You are required to add the following headers to your request:
x-qashier-partner
: The partner ID provided by Qashierx-qashier-sign
: The signature of the request payloadUse crypto-js
library to generate the signature if your language is JavaScript or TypeScript. For other languages, the implementation is similar. You can refer to the example below:
export const signRequestBody = ({
rawString,
hmacKey
}: {
rawString: string;
hmacKey: string;
}) => {
const computedHash = CryptoJS.HmacSHA256(rawString, hmacKey);
const computedHmac = CryptoJS.enc.Base64.stringify(computedHash);
return computedHmac;
};
The signature is computed from the raw request body.
The payload must be identical to the one used in the signature generation in order to ensure the signature is correct.
Example for a POST request:
const requestBody = { clientId: "client123", storeId: "store456", timestamp: 1702500000 };
const rawString = JSON.stringify(requestBody);
const signature = signRequestBody({ rawString, hmacKey: "your-secret-key" });
const response = await fetch('https://api.staging.qashier.com/v2/partner/qpay/initiate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-qashier-partner': 'your-partner-id',
'x-qashier-sign': signature
},
// payload must be identical to the one used in the signature generation
body: rawString
});
The signature is computed from the query parameters, sorted alphabetically by parameter name, and formatted as a query string without the leading '?'.
Example for a GET request with query parameters:
// For a request to /payment-method/list?clientId=client123&storeId=store456×tamp=1702500000
const params = { clientId: "client123", storeId: "store456", timestamp: 1702500000 };
// Sort the keys alphabetically
const sortedKeys = Object.keys(params).sort();
// Create the raw string in the format key1=value1&key2=value2
const rawString = sortedKeys
.map(key => `${key}=${params[key]}`)
.join("&");
// Result: "clientId=client123&storeId=store456×tamp=1702500000"
const signature = signRequestBody({ rawString, hmacKey: "your-secret-key" });
The API may return the following error responses:
Status Code | Error Message | Description |
---|---|---|
400 | Content-Type must be application/json for POST and PUT requests | The Content-Type header is missing or not set to application/json for POST or PUT requests |
400 | Missing signature | The x-qashier-sign header is missing |
400 | Missing timestamp | The timestamp field is missing in the request body (POST/PUT) or query parameters (GET) |
400 | Timestamp is stale or invalid (must be within the last 10 minutes) | The timestamp is more than 10 minutes old or in the future |
400 | Invalid signature | The provided signature does not match the computed signature |
403 | Invalid IP address | The request's IP address is not in the partner's IP whitelist |
403 | Partner is expired | The partner account may not be configured properly, contact your sales or partner manager |
403 | Partner does not have payment API feature enabled | The partner account may not be configured properly, contact your sales or partner manager |
404 | Partner not found | The partner account may not be configured properly, contact your sales or partner manager |
It shows payment methods that the merchant has submitted and are approved.
Respect the "enabled"
field in the response, if it's false, do not use the payment method.
It's false
normally due to deactivation or temporary maintenance.
clientId required | string The client ID |
storeId required | string The store ID of the payment terminal |
timestamp required | integer Unix epoch time in seconds. Must be within 10 minutes of the server's current time. |
x-qashier-sign required | string The signature of the request payload |
{- "success": true,
- "message": "string",
- "data": {
- "paymentMethods": [
- {
- "name": "string",
- "scheme": "visa-master",
- "paymentMethod": "card-payment",
- "country": "SG",
- "voidable": true,
- "enabled": true,
- "brandImages": {
- "sm": "string",
- "md": "string",
- "lg": "string"
}
}
]
}
}
This endpoint is used to initiate a
x-qashier-sign required | string The signature of the request payload |
Must include a timestamp
field in Unix epoch time format (seconds since January 1, 1970).
The timestamp must be within 10 minutes of the server's current time.
clientId required | string |
storeId required | string |
amount required | string The amount to be paid |
currency required | string The currency of the payment |
paymentMethod required | string Value: "card-payment" Currently, only card-payment is supported |
scheme | string Enum: "visa-master" "amex" Optional, default is visa-master |
country required | string Country code |
clientReference required | string Reference for partner |
notificationUrl | string <uri> Webhook URL for payment status notification, make sure the url is callable or just leave it out, check Callbacks for the payload |
{- "clientId": "string",
- "storeId": "string",
- "amount": "string",
- "currency": "SGD",
- "paymentMethod": "card-payment",
- "scheme": "visa-master",
- "country": "SG",
- "clientReference": "string",
}
{- "success": true,
- "message": "string",
- "data": {
- "paymentRecordId": "string",
- "qrString": "string",
- "timeoutSec": 60
}
}
{- "eventCode": "AUTHORIZATION",
- "eventTimestamp": "2019-08-24T14:15:22Z",
- "notificationBody": {
- "remark": "string",
- "scheme": "string",
- "merchantId": "string",
- "terminalId": "string",
- "maskedCardNumber": "string",
- "panSeq": "string",
- "cardEntryMode": "string",
- "aid": "string",
- "authCode": "string",
- "retrievalReferenceNumber": "string",
- "transactionCertificate": "string",
- "result": "approved"
}
}
This endpoint is used to cancel a initiated payment
paymentRecordId required | string The unique ID of the payment |
timestamp required | integer Unix epoch time in seconds. Must be within 10 minutes of the server's current time. |
x-qashier-sign required | string Generate the signature using this string format |
Must include a timestamp
field in Unix epoch time format (seconds since January 1, 1970).
The timestamp must be within 10 minutes of the server's current time.
clientId | string |
remark | string |
{- "clientId": "string",
- "remark": "string"
}
{- "success": true,
- "message": "string",
- "data": { }
}
This endpoint is used to void a payment
paymentRecordId required | string The unique ID of the payment |
timestamp required | integer Unix epoch time in seconds. Must be within 10 minutes of the server's current time. |
x-qashier-sign required | string Generate the signature using this string format |
Must include a timestamp
field in Unix epoch time format (seconds since January 1, 1970).
The timestamp must be within 10 minutes of the server's current time.
clientId required | string |
timestamp required | integer Unix epoch time in seconds |
{- "clientId": "string",
- "timestamp": 0
}
{- "success": true,
- "message": "string",
- "data": { }
}
This endpoint is used to query the payment status
paymentRecordId required | string The unique ID of the payment |
timestamp required | integer Unix epoch time in seconds. Must be within 10 minutes of the server's current time. |
x-qashier-sign required | string The signature of the request payload |
{- "success": true,
- "message": "string",
- "data": {
- "status": "string",
- "cardPaymentInfo": {
- "remark": "string",
- "scheme": "string",
- "merchantId": "string",
- "terminalId": "string",
- "maskedCardNumber": "string",
- "panSeq": "string",
- "cardEntryMode": "string",
- "aid": "string",
- "authCode": "string",
- "retrievalReferenceNumber": "string",
- "transactionCertificate": "string"
}
}
}