Skip to main content
The widget and your page talk in two directions:
  • Events go from the widget to your app. Subscribe with sdk.on().
  • Commands go from your app to the widget. Send them with sdk.send().
Events are for updating your UI. Don’t fulfil or credit anything on a browser event alone: confirm the order on your backend with webhooks, which are signed and retried.

Subscribing

sdk.on(eventType, callback) returns the instance, so calls chain. sdk.off(eventType, callback) unsubscribes and takes the same forms.

Events

Use the RampnowEventType enum: status and paymentStatus use the same values as the API and webhooks. See Order Status.

CryptoTxnInfo

Available in ORDER_CREATED and ORDER_COMPLETED payloads:

Example: full event handling

Commands

sdk.send(commandType, payload) sends a command to the widget iframe and returns the instance. Use the RampnowCommandType enum.
Domain whitelisting required: For security, the widget only accepts commands from whitelisted origins. To whitelist your domain, contact Rampnow. Commands sent from non-whitelisted origins are silently ignored.

Example: submit a transaction hash from your wallet

On a sell order, if your wallet sends the crypto for the user, pass the hash to the widget so it can match the transfer:

Next steps

Webhooks

Confirm order status on your backend

Sandbox Testing

Run every order outcome before going live