Tonder’s Direct API provides a streamlined set of endpoints for processing payments and withdrawals. The unified design eliminates complex multi-step integrations, allowing you to handle transactions through a single endpoint.

Endpoints Summary

There are two endpoints available for processing transactions:

Process Transaction Endpoint

Here you can see the details of how to use the Process Transaction Endpoint.

Transaction Status Endpoint

Here you can see the details of how to use the Transaction Status Endpoint.

Response Codes

The following are the response codes that you may receive in the response.

Success Codes

CodeDescriptionWhen Used
200OKStatus check successful
201CreatedTransaction created successfully
202AcceptedTransaction accepted for processing

Error Codes

CodeDescriptionAction Required
400Bad RequestFix request format
401UnauthorizedCheck authentication
402Payment RequiredPayment declined
404Not FoundCheck transaction ID
422Validation ErrorFix request data
429Rate LimitedRetry with backoff
500Server ErrorRetry request

Implementation Examples

Here you can see the implementation examples for the Process Transaction Endpoint.
import requests
import json

class TonderAPI:
    def __init__(self, api_key, base_url):
        self.api_key = api_key
        self.base_url = base_url
        self.headers = {
            'Authorization': f'Token {api_key}',
            'Content-Type': 'application/json'
        }
    
    def process_payment(self, payment_data):
        """Process a payment transaction"""
        response = requests.post(
            f"{self.base_url}process/",
            headers=self.headers,
            json=payment_data
        )
        
        if response.status_code in [200, 201, 202]:
            return response.json()
        else:
            raise Exception(f"Payment failed: {response.status_code} - {response.text}")
    
    def process_withdrawal(self, withdrawal_data):
        """Process a withdrawal transaction"""
        response = requests.post(
            f"{self.base_url}process/",
            headers=self.headers,
            json=withdrawal_data
        )
        
        if response.status_code in [200, 201, 202]:
            return response.json()
        else:
            raise Exception(f"Withdrawal failed: {response.status_code} - {response.text}")
    
    def get_transaction_status(self, transaction_id):
        """Get transaction status"""
        response = requests.get(
            f"{self.base_url}transactions/{transaction_id}/",
            headers=self.headers
        )
        
        if response.status_code == 200:
            return response.json()
        else:
            raise Exception(f"Status check failed: {response.status_code} - {response.text}")

# Example usage
def main():
    # Initialize API client
    api = TonderAPI(
        api_key="your_api_key",
        base_url="https://stage.tonder.io/api/v1/"
    )
    
    # Process a payment
    payment_data = {
        "operation_type": "payment",
        "amount": 100.00,
        "currency": "MXN",
        "customer": {
            "name": "Test Customer",
            "email": "test@example.com"
        },
        "payment_method": {
            "type": "CARD",
            "card_number": "4242424242424242",
            "cardholder_name": "Test Customer",
            "cvv": "123",
            "expiration_month": "12",
            "expiration_year": "2027"
        },
        "client_reference": "test-001"
    }
    
    try:
        # Process payment
        payment_result = api.process_payment(payment_data)
        print(f"Payment processed: {payment_result['id']}")
        
        # Check status
        status = api.get_transaction_status(payment_result['id'])
        print(f"Payment status: {status['status']}")
        
    except Exception as e:
        print(f"Error: {e}")

Rate Limits

There are rate limits for the Process Transaction Endpoint.
EndpointLimitWindow
POST /process/100 requestsper minute
GET /transactions/300 requestsper minute
Rate limit headers are included in responses:
  • X-RateLimit-Limit: Request limit per window
  • X-RateLimit-Remaining: Requests remaining in current window
  • X-RateLimit-Reset: Unix timestamp when limit resets

Next Steps