Skip to main content

Install

CDN (no bundler):
When loaded from the CDN, the SDK is available as window.RampnowSdk.

Environments

The SDK opens production by default. Set widgetUrl to the sandbox host while you build and test. Build and test against sandbox first. No real money or mainnet crypto moves there. See Sandbox Testing for test payments and testnet tokens.

Open your first session

1

Create an instance

Every option is listed in Configuration.
2

Subscribe to events

See Events & commands for the full list.
3

Open the widget

Without containerId this opens a full-screen overlay. See Display modes for embedded and redirect.

React

The SDK ships with a React hook.
React (>=18) and ReactDOM (>=18) are optional peer dependencies, only required when you use the hook.
The hook returns the same init, close, send, on and isOpen as an SDK instance.

Methods

new RampnowSdk(config)

Creates an SDK instance. Validates the apiKey and merges defaults. Does not open the widget; call .init() to display it.

sdk.init(): RampnowSdk

Opens the widget. If containerId is set, mounts the iframe in that element; otherwise creates a full-screen overlay. Returns this for chaining.

sdk.close(): void

Closes and removes the widget from the DOM.

sdk.on(eventType, callback): RampnowSdk / sdk.off(eventType, callback): RampnowSdk

Subscribe to and unsubscribe from widget events. See Events.

sdk.send(commandType, payload): RampnowSdk

Send a command to the widget iframe. See Commands.

sdk.isOpen: boolean

Read-only. Whether the widget is currently displayed.

RampnowSdk.createRedirectUrl(config): string (static)

Builds a full widget URL from config without opening an iframe. See Redirect mode.

Next: Configuration

Every option you can pass to the SDK