How to Verify and Decode the Webhook Payload
Verify the signed data field in Transak order webhooks with your Partner Access Token, then read the order details
Transak sends the order webhook payload in the data field as a JWT signed with your Partner Access Token (HS256). The JWT is signed, not encrypted: anyone who has it can decode it, so the signature is what proves it came from Transak. Verify the JWT with your Partner Access Token, then read its claims on your backend.
Before You Start
- Your webhook endpoint must already be configured with Transak.
- You need a valid Partner Access Token. Follow How to Create a Partner Access Token.
- Perform verification and decoding only on your server. Do not expose the access token in frontend code.
Always verify the JWT signature before trusting any webhook data. Do not decode the payload without verification.
How It Works
When Transak sends an order webhook, the body includes a signed data field. Your backend should:
When You Refresh Your Partner Access Token
Transak signs each webhook with the Partner Access Token that is current when it sends the webhook. When you call Refresh Access Token to get a new token, every webhook sent after that is signed with the new token. Webhooks that were sent before the refresh stay signed with the old token, and the new token can’t verify them.
For example:
- Transak sends a webhook for order O1, signed with access token AT1.
- You call Refresh Access Token and get access token AT2.
- Transak signs all later webhooks with AT2. The webhook for order O1 can only be verified with AT1, not with AT2.
If you store webhooks and verify them later, for example from a queue, keep your previous access token until you have processed every webhook that was sent before the refresh.