Prerequisites
Before you begin, make sure you have the following:- Sign in at the Tonder Dashboard with your credentials.
- Retrieve your API Key and Secret from the developer section of the dashboard.
Step 1: Set Up Your Environment
You’ll use the sandbox environment for all testing. This allows you to validate your integration end-to-end without processing real money. Use the following base URL for all your test requests:Required Headers
Every request to the Tonder API must include the following headers:Header | Description |
---|---|
Authorization | Contains your unique API key. |
X-Signature-Transaction | Includes the HMAC signature to verify the integrity of the request. Authentication will fail if this is missing or incorrect. |
Content-Type | Specifies that the request body is in JSON format. |
Step 2: Implement the HMAC Signature
To secure your API requests, Tonder uses HMAC-SHA256 signatures to verify that requests are authentic and haven’t been tampered with. For every request that includes a body (like POST or PUT requests), you must generate a unique signature by creating a hash of the request payload using your secret key. This signature proves that the request comes from you and that the data hasn’t been modified in transit.Python Example: HMAC Signature Generation
Python Example: HMAC Signature Generation
This example shows how to create an HMAC-SHA256 signature for a payment request and generate the authentication header needed for API calls. The code follows three key steps: serialize the JSON payload with sorted keys for consistency, calculate the HMAC-SHA256 digest using your secret key, and encode the resulting signature in Base64 format.
HMAC validation is configurable for your business. The Direct API Process Transaction endpoint uses HMAC authentication by default. The specific fields used to generate the signature can also be configured. This example assumes the entire request body is used.
Step 3: Make Your First Payment
Now you’re ready to make your first payment. Send aPOST
request to the Process Transaction endpoint with a request body including the required parameters below:
Parameter | Type | Description |
---|---|---|
operation_type | string | Must be "payment" to process a payment |
amount | number | Payment amount (e.g., 100.00 ) |
currency | string | Currency code (e.g., "MXN" for Mexican Peso) |
customer | object | Customer information containing name and email |
payment_method | object | Payment method details including type and card information |
client_reference | string | Your unique reference for this transaction |
201 Created
status code and a transaction object in the response body.
Field | Description |
---|---|
transaction_id | Unique identifier for this payment in Tonder’s system |
status | Current payment status (e.g., “approved”, “pending”, “declined”) |
payment_id | Internal payment ID for tracking and reference |
merchant_reference | Your original client reference for this transaction |
provider | Payment processor used (e.g., “stripe”, “conekta”) |
transaction_id
to check payment status later, set up webhooks to receive real-time updates, or view transaction details in your dashboard.
Next Steps
- Check out environments to understand sandbox vs production setup.
- Set up proper authentication for secure API access.
- Get to know the full process for going live with your integration.