> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rampnow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Onramp & Offramp SDK Quickstart

> Open Rampnow's buy and sell flow from JavaScript with @rampnow/sdk

The SDK opens the widget as an overlay, with typed config and browser events. No backend or signing needed. Set `orderType` to `buy` (onramp) or `sell` (offramp). Examples run against **sandbox**.

<Tip>
  Using an AI coding agent? Connect it to these docs first: [Build with AI](/quickstart/build-with-ai).
</Tip>

<Steps>
  <Step title="Install">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @rampnow/sdk
      ```

      ```bash pnpm theme={null}
      pnpm add @rampnow/sdk
      ```
    </CodeGroup>
  </Step>

  <Step title="Create the SDK">
    Use your public key (`pk_...`) from the [Partner Dashboard](https://partner.rampnow.io) under **API Hub**.

    <Tabs>
      <Tab title="Onramp (buy)">
        ```javascript theme={null}
        import { RampnowSdk, RampnowEventType } from '@rampnow/sdk'

        const sdk = new RampnowSdk({
          apiKey: 'pk_YOUR_API_KEY',
          widgetUrl: 'https://app.sandbox.rampnow.io',
          orderType: 'buy',
          srcCurrency: 'EUR',
          srcChain: 'fiat',
          srcAmount: '250',
          dstCurrency: 'ETH',
          dstChain: 'ethereum',
          walletAddress: '0xUserWalletAddress',
        })
        ```
      </Tab>

      <Tab title="Offramp (sell)">
        ```javascript theme={null}
        import { RampnowSdk, RampnowEventType } from '@rampnow/sdk'

        const sdk = new RampnowSdk({
          apiKey: 'pk_YOUR_API_KEY',
          widgetUrl: 'https://app.sandbox.rampnow.io',
          orderType: 'sell',
          srcCurrency: 'USDT',
          srcChain: 'ethereum',
          srcAmount: '500',
          dstCurrency: 'EUR',
          dstChain: 'fiat',
        })
        ```
      </Tab>
    </Tabs>

    Drop `widgetUrl` in production; it defaults to `https://app.rampnow.io`.
  </Step>

  <Step title="Listen and open">
    ```javascript theme={null}
    sdk.on(RampnowEventType.ORDER_COMPLETED, (e) => {
      console.log('Order completed:', e.payload.orderUid)
    })

    sdk.init()
    ```
  </Step>

  <Step title="Receive webhooks">
    Add your webhook URL in the Partner Dashboard under **API Hub**. Rampnow posts on every order status change. See [Webhook](/api-reference/webhook).
  </Step>
</Steps>

<Card title="Full guide" icon="book-open" href="/quickstart/ramp-sdk/overview">
  Embedded and redirect modes, every event, commands and the React hook
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.