Launch an on-ramp
Build a 0Gate buy flow that moves a user from fiat into a supported crypto or stablecoin asset through the hosted surface.
Use a 0Gate on-ramp when your product already knows the user wants to buy or fund with fiat. Your backend creates a session with flow: "on_ramp", optional asset and network constraints, and a return URL. The hosted 0Gate experience runs the user-facing ramp steps and your backend waits for signed events before crediting the user.
Flow
Before creating the session
| Check | Why |
|---|---|
| Country and eligibility | Do not show the buy path if the user's region is not supported for the active environment. |
| Fiat currency | The session currency should be supported for the user's region and partner configuration. |
| Target asset and network | Only constrain to assets and chains that are currently supported for on-ramp. |
| Wallet destination | If you prefill a wallet, validate the network and user ownership on your side first. |
| Return and cancel URLs | The URL origins must be allowed for the partner and should land in a safe order-state page. |
Session shape
const session = await gate.sessions.create(
{
amount: '100.00',
currency: 'EUR',
flow: 'on_ramp',
target_token: 'USDC',
target_network: 'ETHEREUM',
wallet_address: '0x0000000000000000000000000000000000000000',
return_url: 'https://app.example/orders/order_123/return',
cancel_url: 'https://app.example/orders/order_123/cancelled',
user_reference: 'order_123',
metadata: { order_id: 'order_123' },
},
{ idempotencyKey: 'order_123_on_ramp_attempt_1' },
);The example uses fake values. Do not publish real keys, wallet addresses tied to customers, identity data, or internal order notes in public docs or support screenshots.
Completion model
| Signal | Use |
|---|---|
onSuccess callback | Move the user to a pending or success-looking UX state. |
gate_session.processing | Keep the order pending while the hosted flow is still moving. |
gate_session.completed | After signature verification and event dedupe, credit or mark the order complete. |
gate_session.failed | Show a recoverable failure path and let the user retry with a new session when appropriate. |
gate_session.expired or cancelled | Close the attempt and require a fresh session for a new buy. |
Do not credit from the browser
The hosted flow can call onSuccess before your backend has processed the signed event. Credit balances, unlock access,
or mark an order paid only after verified backend state.