Webhooks
The Webhook feature allows your system to receive real-time updates about the status of transactions. When a transaction status changes, Tumipay sends a POST request to the URL provided in theipn_url field during the transaction creation.
Webhook Payload
The webhook payload is a JSON object containing the following information:Webhook Payload
Payload Properties
Transaction Status Fields
Transaction Status Fields
The status of the transaction. Possible values:
APPROVED: The transaction was successfully completedREJECTED: The transaction failed during the normal flow (e.g., declined by the bank)DECLINED: The transaction was canceled due to internal rules, such as fraud detection, transactional limits, or merchant configurationsPENDING: The transaction is in progress and awaiting confirmationCREATED: The transaction has been initiated but not yet processedEXPIRED: The transaction has expired due to timeout
Unique identifier of the transaction
Reference identifier provided by the merchant for the transaction
Transaction Details Fields
Transaction Details Fields
Total amount of the transaction
Currency of the transaction (e.g.,
COP)The payment method used (e.g.,
RECAUDO)Name of the bank involved in the transaction
Message describing the transaction’s outcome
Customer Information Fields
Customer Information Fields
Webhook Security
Request Headers
The webhook request includes the following headers for validation:
Signature Generation
The signature is generated using the SHA256 algorithm by hashing a JSON object that includes the customer token, the transaction ticket, and the transaction reference.Signature Format
Signature Verification Steps
1
Reconstruct the JSON object
Create a JSON string with your client token and the received transaction details
2
Apply SHA256 algorithm
Generate a signature by hashing the JSON object with SHA256
3
Compare signatures
Compare your generated signature with the one in the
x-trx-signature header4
Validate request
Only process the webhook if the signatures match
Handling Webhook Events
Retry Schedule
If Tumipay does not receive a successful response, it will retry sending the webhook according to this schedule:First Retry
5 minutes after the initial attempt
Second Retry
15 minutes after the first retry
Third Retry
30 minutes after the second retry
Fourth Retry
1 hour after the third retry
Fifth Retry
2 hours after the fourth retry
Example Use Case: Declined vs Rejected
- DECLINED
- REJECTED
Indicates the transaction was canceled internally by merchant-specific rules, such as:
- Fraud detection triggers
- Exceeding transactional limits
- Additional configurations made by the merchant
Example Use Case: Idempotent Processing
To prevent processing the same webhook event multiple times, implement idempotency checks in your webhook handler.
1
Store processed transactions
Store a record of processed transactions using their
top_ticket or top_reference as a unique key2
Check for duplicates
When a webhook is received, check if the
top_ticket already exists in your database3
Handle accordingly
If the transaction exists, skip processing to avoid duplicates. Otherwise, proceed with handling the event and store the record
By following these practices, you can ensure a reliable and secure webhook implementation that effectively handles real-time transaction updates.
Handling Common Response Messages
Common Rejection Messages
When receiving webhooks, be prepared to handle these common response messages for transactions with “REJECTED” status:
Account Issues
Account Issues
- “Esta cuenta está inactiva/bloqueada” - Account is inactive/blocked
- “La cuenta o Nit no corresponden” - Account or tax ID do not match
- “El número de cuenta no existe” - Account number does not exist
- “El número de cuenta no es válido” - Account number is invalid
- “Cuenta no autorizada” - Unauthorized account
Document Issues
Document Issues
- “El Nit no es válido” - Invalid tax ID
Other Issues
Other Issues
- “El producto de destino no existe” - Destination product does not exist
- “Excede el tope saldo de la cuenta destino” - Exceeds destination account balance limit