Skip to main content

How to integrate the ONRAMP widget

Overview​

Use Fiat Deposit API to generate an ONRAMP widget key, build the widget URL, and let the customer complete fiat payment through the hosted Calypso page.

Integration flow​

  1. Generate a widget key by using [POST] fiat/deposit/key/generate.
  2. Build the widget URL with account, widgetKey, and idempotencyKey.
  3. Redirect the customer to the widget URL or embed the widget into the merchant website with iframe.
  4. Track payment status through ONRAMP webhooks and, if needed, verify the order by using [POST] fiat/deposit/order.

Sequence​

Names of requests on the scheme indicate Fiat Deposit API methods and ONRAMP webhook events.

ONRAMP widget sequence

Common request fields​

Fiat Deposit API methods use the standard request wrapper.

FieldTypeRequiredDescription
accountstringYesMerchant account ID. The request will be sent for this account.
timestampnumberYesCurrent Unix UTC timestamp in milliseconds. The value must not be less than 3 minutes in the past or greater than 3 minutes in the future.
payloadobjectYesObject with method-specific request data.

Generate widget key​

Use [POST] fiat/deposit/key/generate.

Payload fieldTypeRequiredDescription
currencyDataarrayYesList of cryptocurrencies available in the widget.
descriptionstringYesOrder or payment description.
merchantExternalIdstringNoMerchant-side order ID or customer ID.
returnUrlstringYesURL where the customer returns after completing payment.
idempotencyKeystringYesExternal ID in UUID format.

currencyData fields​

FieldTypeRequiredDescription
currencystringYesCryptocurrency that the merchant wants to receive.
amountnumberNoFixed cryptocurrency amount. If omitted, the customer can enter the amount in the widget.
externalAddressstringNoExternal cryptocurrency address for external address flow.

Currency data behavior​

If you specify a single cryptocurrency, you can optionally set a payment amount for it. In this case, the customer cannot change the purchase amount for this cryptocurrency in the widget.

If you specify a list of cryptocurrencies, the customer can select one of the available cryptocurrencies in the widget and enter the amount to purchase or top up their balance on your website.

Currency data rules​

For the widget to work correctly when requesting a list of cryptocurrencies, follow these rules:

CaseRule
Single cryptocurrency with fixed amountPass one currencyData item with currency and amount.
Multiple cryptocurrenciesDo not pass amount in the currencyData list.
External address flowIf one currencyData item has externalAddress, all items in the list must include externalAddress.

Request example: fixed amount​

{
"account": "0x0000000000000000000000000000000000000000",
"timestamp": 1761650432438,
"payload": {
"currencyData": [
{
"currency": "USDT_TRX",
"amount": 100
}
],
"description": "Order #1001",
"merchantExternalId": "order-1001",
"returnUrl": "https://merchant.com/checkout",
"idempotencyKey": "123e4567-e89b-12d3-a456-426614174000"
}
}

Request example: multiple currencies​

{
"account": "0x0000000000000000000000000000000000000000",
"timestamp": 1761650432438,
"payload": {
"currencyData": [
{
"currency": "USDT_TRX"
},
{
"currency": "USDT_BSC"
},
{
"currency": "BTC"
}
],
"description": "Account top-up",
"merchantExternalId": "customer-1001",
"returnUrl": "https://merchant.com/top-up",
"idempotencyKey": "123e4567-e89b-12d3-a456-426614174001"
}
}

Response fields​

FieldTypeDescription
keystringWidget access key. Use it as widgetKey in the widget URL.
expiredAtstringDate and time when the widget key expires.

Widget URL​

Use the returned key as widgetKey.

ParameterRequiredDescription
accountYesMerchant account ID.
widgetKeyYesWidget access key returned by fiat/deposit/key/generate.
idempotencyKeyYesSame idempotencyKey that was used when generating the widget key.

URL example​

https://pay.calypso.money/onramp?account=0x0000000000000000000000000000000000000000&widgetKey=123e4567-e89b-12d3-a456-426614174002&idempotencyKey=123e4567-e89b-12d3-a456-426614174000

Get onramp order info​

Use [POST] fiat/deposit/order after receiving a webhook or postMessage event.

Payload fieldTypeRequiredDescription
idstringYesOnramp order ID.

Response fields​

FieldTypeDescription
externalAddressstringExternal cryptocurrency address, if used.
idstringCalypso onramp order ID.
cryptoAmountnumberCryptocurrency amount.
fiatAmountnumberFiat amount.
fiatCurrencystringFiat currency paid by the customer.
currencystringCryptocurrency received by the merchant.
statestringCurrent onramp order status.
hashstringBlockchain transaction hash, if available.

Onramp order statuses​

StatusDescription
CREATEDOnramp order was created.
IN_PROGRESSOnramp order is being processed.
PAIDCustomer fiat payment was received.
DEPOSIT_COMPLETEDCryptocurrency deposit was credited to the merchant Calypso account.
EXTERNAL_WITHDRAWAL_IN_PROGRESSWithdrawal to externalAddress is in progress.
PAUSEDWithdrawal to externalAddress requires attention or cannot be completed automatically.
COMPLETEDOnramp order processing was completed.
FAILEDOnramp order payment or processing failed.
EXPIREDCustomer did not complete payment before the order expired.

postMessage events​

When the widget is embedded with iframe, it can send order state updates to the parent window through postMessage.

Widget stateMeaning
unpaidOrder was created and is waiting for payment.
paidOrder was paid.
expiredOrder expired before successful payment.

unpaid example​

{
"orderId": "123e4567-e89b-12d3-a456-426614174003",
"merchantExternalId": "order-1001",
"state": "unpaid",
"currency": "USDT_TRX",
"orderCryptoAmount": 100,
"fiatCurrency": "USD",
"orderFiatAmount": 100
}
{
"orderId": "123e4567-e89b-12d3-a456-426614174003",
"merchantExternalId": "order-1001",
"state": "paid",
"currency": "USDT_TRX",
"orderCryptoAmount": 100,
"paymentCryptoAmount": 100,
"fiatCurrency": "USD",
"orderFiatAmount": 100,
"paymentFiatAmount": 100
}

expired example​

{
"orderId": "123e4567-e89b-12d3-a456-426614174003",
"merchantExternalId": "order-1001",
"state": "expired"
}

Use postMessage events for customer-facing UI updates. Use ONRAMP webhooks and [POST] fiat/deposit/order as the source of truth for backend order processing.

DocumentLink
Customize ONRAMP widgetHow to customize the ONRAMP widget
Embed ONRAMP widgetHow to embed the ONRAMP widget to your site
ONRAMP webhooksONRAMP webhooks