Webhook
Overview
Tylt provides a webhook mechanism for merchants to receive real-time updates on the status of their payment instance, whether for pay-ins or for pay-outs. Merchants can specify a callBackUrl
in their API requests, and Tylt will send notifications to this URL whenever there is a status change in the transaction.
Setting Up the Webhook
Implement a Callback Endpoint: Merchants must set up an HTTP POST endpoint that can receive JSON payloads. This endpoint should be capable of processing the incoming webhook data and verifying its authenticity using HMAC-SHA256 signature validation.
Insert the Callback URL: While calling the Create Pay-in or Create Pay-out instance API's , insert your endpoint URL in the
callBackUrl
field. Tylt will send updates to this URL whenever the transaction status changes.Status Updates: The life cycle of a payment instance is tracked via
eventId
. Below is the list of possibleeventId
values and their meanings:eventId
Description
0
The instance is created. User is yet to interact with the instance.
1
Trade initiated.
2
Waiting for the buyer to make and confirm payment via UPI.
3
Buyer confirms making payment. Seller is verifying the payment.
4
Payment acknowledged and trade completed.
5
Payment disputed. Trade moved to dispute.
6
Payment acknowledged and trade completed by the system.
9
Trade expired as action or payment was not completed prior to the deadline.
Instance Information
The response related to an instance information contains two primary objects:
1. Trade Object
This object contains all the information about the customer buying or selling USDT from the counterparty. It includes fields like:
Trade lifecycle details (
eventId
, deadlines, description).Fiat and cryptocurrency details (currency name, symbol, amount, etc.).
Payment method information (e.g., UPI).
2. Transaction Object
This object contains all the information about the financial debit or credit carried out on the merchant's account. It is relevant to merchants for crediting or debiting a consumer for the transaction. The transaction
object is updated only when the eventId
is 4, representing the completion of the trade
Callback Validation: To ensure the integrity and authenticity of the callback, Tylt signs each callback payload using HMAC-SHA256 with the merchant’s API secret key. This signature is sent in the HTTP header
X-TLP-SIGNATURE
.Acknowledge the Callback: Upon receiving the callback, merchants must respond with an HTTP 200 status code and the text
"ok"
in the response body. This acknowledges the successful receipt of the callback. If the acknowledgment is not received, the webhook will not be retried automatically. Merchants can manually resend webhooks from their Tylt dashboard.
Validating Callbacks
Merchants should validate the HMAC signature included in the X-TLP-SIGNATURE
header to ensure the callback is from Tylt and has not been tampered with. The HMAC signature is generated using the raw POST data and the MERCHANT_API_SECRET
as the shared key.
Example Web-hook Handling Code
Again, please note that these code snippets serve as examples and may require modifications based on your specific implementation and framework.
Example of Web-hook Responses
Again, please note that these response snippets serve as examples and may require modifications based on your specific implementation and framework.
Important Considerations
Security: Always verify the
X-TLP-SIGNATURE
header to ensure the callback originates from Tylt.Response: Always return an HTTP 200 response with
"ok"
in the body to acknowledge successful receipt of the webhook.Manual Retry: In case of missed callbacks, use the tylt.monry dashboard to manually resend the webhook.
Last updated