Set webhook URL
Payments
Addcallback_url to the request body when you call POST /offramp/initiate to create a payment for stablecoin to local currency conversion. See Stablecoin to NGN for a guide.
Wallets
Addcallback_url when you call POST /wallet/create, or update it later on the wallet, so you can get webhook notifications about deposits and withdrawals on your wallet. See Create stablecoin wallet.
How notifications work
Switch sends each notification as:- Method:
POST - Headers:
Content-Type: application/json,x-switch-signature(HMAC-SHA256 hex digest of the raw body),x-switch-timestamp(when the request was sent; use for optional replay windows) - Body: JSON payload (depending on context; see Payment webhooks or Wallet webhooks)
Your server should acknowledge the request by returning any 2xx status
quickly for successfully received notifications. Switch will retry delivery up
to 3 times if the server does not acknowledge the request.
Verify webhooks
Always verify that incoming requests comes from Switch before you trust.How to verify
- Read the body and the
x-switch-signatureheader from the incoming request. - Compute the expected webhook signature using your
switch service keyand thebody. - Compare the
computedsignature to thex-switch-signaturefrom request header.
Payment webhooks
You receive these notifications whenevercallback_url is set on your payment initiation request payload.
Payment status
Example payload
For a USDC on Base to Nigeria Naira (NGN) inAWAITING_DEPOSIT status.
Payload field reference
meta.session_id is only present when the bank payment has been initiated
and is successfully processed.meta.explorer_url and meta.hash are only present when the deposit
has been made on-chain to the provided deposit address.Wallet webhooks
You receive these notifications whenevercallback_url is set on your wallet (at creation or via update) and the wallet receives or sends funds.
Example wallet payload
Incoming USDC on Base to the wallet address.Wallet payload field reference
Need Help?
Send us a message
Call
Book a call with us