Webhooks
The Webhook feature allows your system to receive real-time updates about the status of transactions. When a transaction status changes, Tumipay sends aPOST request to the URL provided in the ipn_url field during the transaction creation.
Webhook Payload
The webhook payload is a JSON object containing the following information:- top_status: The status of the transaction. Possible values:
APPROVED: The transaction was successfully completed.REJECTED: 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 additional configurations by the merchant.PENDING: The transaction is in progress and awaiting confirmation.
- top_ticket: Unique identifier of the transaction.
- top_reference: Reference identifier provided by the merchant for the transaction.
- top_amount: Total amount of the transaction.
- top_currency: Currency of the transaction (e.g., COP).
- top_payment_method: The payment method used (e.g., RECAUDO).
- top_bank_name: Name of the bank involved in the transaction.
- top_response_message: Message describing the transaction’s outcome.
- top_user: An object containing detailed information about the user/customer:
- legal_doc_type: Type of the customer legal document (e.g., CC).
- legal_doc: Customer legal document number.
- phone_code: Customer country phone code.
- phone_number: Customer phone number.
- email: Customer email address.
- full_name: Customer full name.
- top_user_email: Customer email address (repeated for convenience).
- top_user_phone: Customer phone number (repeated for convenience).
- top_card: An object containing information about the card used in the transaction (if applicable):
- bank: Name of the issuing bank.
- bin: Bank Identification Number (first 6 digits of the card).
- country: Country of issuance.
- lastFourDigits: Last four digits of the card number.
- type: Card type (e.g., credit, debit).
- brand: Card brand (e.g., Visa, Mastercard).
- top_extra_params1: Additional parameters.
Webhook Headers The webhook request includes the following headers for validation:
- x-trx-signature: A signature generated based on certain values in the payload.
- User-Agent: The user agent for the webhook is
Tumipay/1.1.
Php
Handling Webhook Events
Your system should respond to webhook requests with a200 OK HTTP status code to confirm successful receipt. If Tumipay does not receive this response, it will automatically retry the webhook delivery up to three times.
Example Use Case: Declined vs Rejected
- DECLINED: Indicates the transaction was canceled internally by merchant-specific rules, such as:
- Fraud detection triggers.
- Exceeding transactional limits.
- Additional configurations made by the merchant.
- REJECTED: Indicates the transaction was declined during the normal transaction process, such as:
- Insufficient funds.
- Bank-specific rejections.
Example Use Case: Idempotent Processing
To prevent processing the same webhook event multiple times:- Store a record of processed transactions using their
top_ticketortop_referenceas a unique key. - When a webhook is received, check if the
top_ticketalready exists in your database:- If it exists, skip processing.
- If it does not exist, proceed with handling the event and store the record.