This documentation details the API for topping up student bus cards, including environment endpoints, security, and examples of successful and error payloads.
API Endpoints
Environment
Base URL
Purpose
Sandbox
https://sandbox.api.dimepay.app
For development and testing with simulated transactions.
Production Yes
https://api.dimepay.app
For live transactions with real users and real funds.
Security and Authentication
Authentication requires a Client-Key in the header and a request body that is the HMAC-SHA256 signature of the transaction payload.
1. Client-Key Header
Header Name
Type
Description
Client-Key
String
Your unique identifier for accessing the API.
2. Request Body (data Field)
The entire request body is a JSON object with a single field, data, which is the signature.
Field Name
Type
Description
data
String
The HMAC-SHA256 signature (hexadecimal string) of the canonical JSON string containing the transaction details.
Signature Calculation
Construct Details Object: Build the JSON object with card_number, amount, currency, and optional billing_details.
Canonicalize: Serialize this object into a JSON string, ensuring alphabetical key order and no whitespace.
Sign: Calculate the HMAC-SHA256 signature of the canonical string using your Secret Key.
Errors return a standard JSON object containing a brief status, a specific error code, and a descriptive message.
HTTP Status
Error Code
Example Description
401 Unauthorized
INVALID_SIGNATURE
The HMAC-SHA256 signature in the data field failed validation.
{ "status": "error", "code": "INVALID_SIGNATURE", "message": "The signature provided in the 'data' field is invalid or could not be verified with the client's secret key."}
HTTP Status
Error Code
Example Description
400 Bad Request
CARD_NUMBER_INVALID
The bus card number extracted from the payload is malformed.
{ "status": "error", "code": "CARD_NUMBER_INVALID", "message": "The card number extracted from the signed payload is in an incorrect format."}