Set callback 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 works
Switch sends each notification as:- Method:
POST - Header:
Content-Type: application/json - Body: JSON payload (Depends 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.
Payment webhooks
You receive this notifications whenevercallback_url is set on your payment initiation request payload.
Payment status
| Status | Description |
|---|---|
AWAITING_DEPOSIT | Waiting for the user to send the stablecoin. |
PROCESSING | Stablecoin received is being processed. |
COMPLETED | Stablecoin payout to local currency is completed. |
FAILED | Stablecoin payout to local currency failed. |
REVERSED | Stablecoin payout to local currency was reversed. |
SCHEDULED | Payment is delayed due to liquidity constraints. |
BLOCKED | Payment is blocked for compliance or risk reasons. |
Example payload
For a USDC on Base to Nigeria Naira (NGN) inAWAITING_DEPOSIT status.
Payload field reference
| Field | Type | Description |
|---|---|---|
status | string | Current status; see Payment status. |
type | string | OFFRAMP or ONRAMP. |
reference | string | Unique transaction reference (UUID). |
source.amount | number | Amount of source to be sent. |
source.currency | string | Source currency code e.g. USDC. |
source.network | string | Source network e.g. Base. |
destination.amount | number | Amount of destination to be received. |
destination.currency | string | Destination currency code e.g. NGN. |
destination.network | string | Destination network e.g. Fiat. |
deposit.amount | number | Amount to send to the deposit address. |
deposit.address | string | Wallet address to send the amount to. |
deposit.asset | string | Asset to deposit e.g. base:usdc. |
deposit.note | string[] | Specific instructions for the deposit |
meta.session_id | string | Payout bank transfer session ID. |
meta.explorer_url | string | URL to view the deposit on-chain. |
meta.hash | string | Hash of the deposit transaction. |
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 deposits and withdrawals
Whencallback_url is set on a wallet, Switch sends a JSON POST for on-chain deposits (receive) and withdrawals (send) involving that wallet.
Example wallet payload
Incoming USDC on Base to the wallet address.Wallet payload field reference
| Field | Type | Description |
|---|---|---|
address | string | Wallet address involved in the event. |
token | string | Contract address of the token on the network. |
decimals | number | Token decimals (for interpreting amount). |
type | string | receive for deposits to the wallet, send for withdrawals from the wallet. |
sender | string | Address that sent the funds. |
receiver | string | Address that received the funds. |
hash | string | On-chain transaction hash. |
amount | number | Amount in the token’s smallest unit; divide by 10^decimals for a human-readable balance. |
asset | string | Switch asset id (e.g. base:usdc). |
Need Help?
Send us a message
Call
Book a call with us