Add On-Ramping To Your Site
This guide gives an overview on how to implement the On-Ramping functionality using Pay.io's Payment Gateway and User Payment API. Learn more about the feature and benefits in On-Ramping: Buying Crypto with Fiat.
API endpoint used in this guide -> Create a Payment Session
Integration Flow
The integration relies on a single backend API call to generate a unique URL, which is then rendered on your frontend within an iframe.
Generate the On Ramp URL (Backend)
To initiate the flow, your backend must call the Pay.io User Payments API to generate a unique, user-specific URL.
Endpoint: POST /v1/user/payments
Authentication: API Key (Bearer YOUR_API_KEY in the header)
Key Parameters
country- The user's ISO 3166-1 alpha-2 country code (e.g.GB,DE). Required, no default — dictates which payment methods (like Apple Pay) are displayed in the widget, and is locked into the widget once set.currency_id- UUID of the target cryptocurrency the user is buying. Must be a currency your merchant account has enabled with the provider.user_reference_id- Your platform's stable, unique player ID. Required unlesscustom_wallet_addressis supplied — used to attribute the session to a system-custody wallet and is echoed back in webhooks as the customer identifier.custom_wallet_address- The user's own (self-custody) wallet address to receive funds instead of your platform's managed wallet. Optional. Only honoured if your merchant account has the custom-external-wallet flag enabled — otherwise the request is rejected with403 custom_wallet_not_allowed_for_merchant. Contact your account manager to enable it.amount/fiat_currency- The fiat amount and 3-letter ISO 4217 currency the user is paying with. Both required for ON_RAMP and locked into the widget, so the user can't change them mid-flow.redirect_url- Where the widget sends the user after completing (or abandoning) the flow. Must start withhttp://orhttps://.session_reference(optional) - Your own idempotency/tracking ID for this session. Echoed back in webhooks alongsidecorrelation_key.
Render the iframe (Frontend)
Once your backend receives the link from the API, pass it to your frontend. You will need to embed this URL seamlessly into your Cashier UI, so the user does not feel like they are leaving your site.
Best Practices
Ensure the iframe width is 100% of its container, especially for mobile users.
Give the iframe a sufficient minimum height (e.g.,
600pxto700px) to prevent awkward inner scrolling during the KYC steps.Remove default borders to make the widget look native to your platform.
The allow="camera; microphone" attributes are crucial, as users may need their device camera to upload ID documents for the KYC verification step.
Last updated