How it works
- Your backend requests a signed checkout URL for the user’s account.
- You show the URL in an iframe or in-app browser.
- The user completes payment (and KYC, when required) with Swapped.
- You receive
onramp-orderwebhooks as the order progresses. - Swapped sends the purchased crypto — currently USDC on Base — to the account. From here the standard pipeline takes over: the deposit is detected, bridged to the account’s target, and reported via the regular deposit webhooks.
Prerequisites
- The account is registered — minting a checkout URL for an account that isn’t registered to your project returns
403 Unauthorized. - A webhook URL is configured if you want order updates pushed rather than polled.
- Calls are made from your backend. The endpoints require your API key, which never ships in client-side code.
Mint a checkout URL
smartAccount is required. The optional fields prefill the widget:
The response carries the signed URL:
The URL is signed by the service, so its parameters — destination wallet and asset — can’t be modified client-side. Mint a fresh URL for each checkout session. The purchase always settles in the asset reported by
currencyCode; when the account’s target differs, the bridge hop happens automatically.
Full request and response schemas: POST /onramp/swapped/widget-url.
Fund from an exchange
To let users transfer from a centralized exchange balance (Binance, Coinbase, and others) instead of paying with fiat, mint a Connect URL. The request takes a subset of the widget fields —smartAccount plus optional baseCountry, baseCurrencyCode, locale, and a connection preselecting the exchange. There’s no amount or payment-method prefill; the user chooses those inside the exchange flow. The response shape is identical:
GET /onramp/swapped/connect-exchanges; full schema at POST /onramp/swapped/connect-url.
Show the widget
Embed the URL in an iframe with payment and camera permissions — Apple Pay and camera-based KYC need them:SFSafariViewController on iOS, Chrome Custom Tabs on Android) rather than a plain WebView — Apple Pay and camera access are restricted in bare WebViews.
The URL carries no redirect or callback parameter. Detect completion through the onramp-order webhook or by polling order status, then dismiss the widget from your own UI.
Track the order
Orders move through a normalized lifecycle:
Each transition fires an
onramp-order webhook carrying the normalized status, Swapped’s rawStatus, the fiat receipt, and — once completed — the on-chain transactionId.
You can also poll the account’s latest order:
{ ok: false, reason: "no_order" } before the first order update arrives. Full schema: GET /onramp/swapped/status/{smartAccount}.
Once the order completes, the on-ramp hands off to the regular pipeline: transactionId reappears as the transactionHash on the deposit-received event, followed by the usual bridge events. Card and Apple Pay orders typically complete within minutes; bank transfers can take days. Orders stay trackable for 7 days.
Good to know
- Session coverage — on-ramp purchases land on Base, so the account’s session set must include Base. The default registration flow covers every supported chain; if you restrict
sessionChainIds, include Base or landed funds can’t be bridged. - Deposit whitelist — if you restrict accepted deposits, allow USDC on Base above your minimum. Otherwise every on-ramp purchase is rejected with
deposit-rejected. - Same-chain target — when the account’s target is USDC on Base paid to the account itself, the purchase is already at its destination: no bridge events fire, and
onramp-orderwithstatus: "completed"is your terminal signal. - KYC and limits — identity verification and purchase limits are handled by Swapped inside the widget.