Skip to main content
Buy crypto with credit card, Apple Pay, or Google Pay. Onramp Widget When to use:
  • New players without existing crypto
  • Topping up wallets with fiat
  • Simplest path to getting tokens

Installation

npm install @imtbl/sdk

Quick Start

import { checkout } from '@imtbl/sdk';
import { Environment } from '@imtbl/sdk/config';

const { Checkout, WidgetType, WidgetTheme, CommerceFlowType, CommerceEventType } = checkout;

const checkoutSDK = new Checkout({
  baseConfig: {
    environment: Environment.SANDBOX,
    publishableKey: 'YOUR_PUBLISHABLE_KEY',
  },
});

// Basic onramp flow - buy crypto with fiat
export async function openOnramp(elementId: string) {
  const widgets = await checkoutSDK.widgets({ config: { theme: WidgetTheme.DARK } });
  const widget = widgets.create(WidgetType.IMMUTABLE_COMMERCE);

  widget.mount(elementId, { flow: CommerceFlowType.ONRAMP });

  widget.addListener(CommerceEventType.SUCCESS, (data) => {
    console.log('Onramp complete:', data);
    widget.unmount();
  });

  widget.addListener(CommerceEventType.FAILURE, (data) => {
    console.error('Onramp failed:', data);
    widget.unmount();
  });

  widget.addListener(CommerceEventType.CLOSE, () => {
    widget.unmount();
  });

  return widget;
}

// Onramp with pre-selected token and amount
export async function onrampWithAmount(
  elementId: string,
  options: {
    tokenAddress?: string;
    amount?: string;
  }
) {
  const widgets = await checkoutSDK.widgets({ config: { theme: WidgetTheme.DARK } });
  const widget = widgets.create(WidgetType.IMMUTABLE_COMMERCE);

  widget.mount(elementId, {
    flow: CommerceFlowType.ONRAMP,
    tokenAddress: options.tokenAddress,
    amount: options.amount,
  });

  return widget;
}

Parameters

ParameterTypeDescription
flow'ONRAMP'Required. Specifies the onramp flow
tokenAddressstringToken to purchase
amountstringAmount to purchase (in token units)

Events

EventDescriptionPayload
SUCCESSPurchase completed{ token, amount }
FAILUREPurchase failed{ error }
CLOSEUser closed widget

Supported Tokens

TokenAvailable
IMX
USDC
ETH

Payment Methods

MethodAvailability
Credit/Debit CardGlobal
Apple PayiOS/Safari
Google PayAndroid/Chrome
Bank TransferSelect regions

How It Works

The onramp is powered by Transak:
1. User selects token and amount

2. Enter payment details (first time only)

3. KYC verification (if required for amount)

4. Payment processed

5. Tokens delivered to wallet
Transactions above certain thresholds may require identity verification (KYC). This is a one-time process.

Fees

  • Service fee: ~1-3% (varies by payment method)
  • Network fee: Included in the quoted price
  • No hidden fees

Next Steps