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

# Quickstart

> Build a working MoonPay off-ramp integration in your browser, from setup to a live crypto-to-fiat sale.

## Overview

<Frame caption="Overview">
  <img width="340" src="https://mintcdn.com/moonpay/Kzio-7fxRExSXZf_/images/widget/269d611-Screenshot_2024-02-02_at_11.17.47_AM.png?fit=max&auto=format&n=Kzio-7fxRExSXZf_&q=85&s=855a2974ed81959f1c22283574a0708c" alt="Overview" data-path="images/widget/269d611-Screenshot_2024-02-02_at_11.17.47_AM.png" />
</Frame>

In this Quickstart, you will process the sale of cryptocurrency via the MoonPay Off-Ramp, directly from your browser.

Whether you are a complete beginner to coding or a seasoned expert, this guide will take you through all of the necessary steps to have you converting cryptocurrency to fiat in no time.

***

## What you will accomplish

In this tutorial, you will:

* Configure Off-Ramps widget in a local environment
  * Create a new folder for the implementation
  * Initialize the widget in a file using HTML and JavaScript
  * Edit the widget parameters
  * Display the fully functional widget locally in your browser

***

## Prerequisites

Before beginning, you will need:

* **A MoonPay account**: If you do not have one, set one up through our team on [this page](https://dashboard.moonpay.com/signup).
* **An IDE (coding software):** Some popular ones are [Visual Studio](https://visualstudio.microsoft.com/downloads/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), and [Eclipse](https://eclipseide.org/). We will be using Visual Studio in this tutorial.
* **A web browser:** Any web browser will work. We will be using Google Chrome in this tutorial.

***

## Implementation

### Step 1: Set up a file for your integration

In your IDE, create a new file for your On-Ramp code. Ours will be called `off-ramp.html`.

### Step 2: Retrieve API keys from the MoonPay Dashboard

* Navigate to your [MoonPay Dashboard](https://dashboard.moonpay.com/) and log in.
* Once logged in, navigate to the Developers tab on the sidebar → API Keys.
  * Here, you will be able to copy your API keys. In this tutorial, we will be using the publishable test key.

<Frame caption="Dashboard">
  <img src="https://mintcdn.com/moonpay/Kzio-7fxRExSXZf_/images/widget/d744891-Screenshot_2023-10-27_at_2.09.05_PM.png?fit=max&auto=format&n=Kzio-7fxRExSXZf_&q=85&s=fb66b14d1296f14f782ad4b7edba63b1" alt="Dashboard" width="3024" height="1636" data-path="images/widget/d744891-Screenshot_2023-10-27_at_2.09.05_PM.png" />
</Frame>

### Step 3: Insert HTML and code into off-ramp.html

* The code below will embed our Software Development Kit (SDK) directly into your HTML by way of `<script>` tags.
* You can think of this as a way of injecting code directly into HTML without having to create a separate linked file.

```html off-ramp.html theme={null}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>MoonPay Integration</title>

    <!-- Adds the MoonPay SDK as a script to your HTML file -->
    <script
      defer
      src="https://static.moonpay.com/web-sdk/v1/moonpay-web-sdk.min.js"
    ></script>

    <!-- Initialize the MoonPay SDK immediately upon page load -->
    <script>
      document.addEventListener("DOMContentLoaded", () => {
        const moonpaySdk = window.MoonPayWebSdk.init({
          flow: "sell",
          environment: "sandbox",
          variant: "overlay",
          params: {
            apiKey: "pk_test", // Replace with your MoonPay publishable test API key
            baseCurrencyCode: "eth",
            baseCurrencyAmount: ".15",
            defaultBaseCurrencyCode: "eth",

            quoteCurrencyCode: "usd",
          },
        });

        // Open widget
        moonpaySdk.show();
      });
    </script>
  </head>

  <body>
    <div class="container"></div>
  </body>
</html>
```

* This script will detect when the HTML page loads and immediately run the JavaScript within the `<script>` tags when the load has finished. Remember to replace `pk_test` with your publishable test API key from **Step 1**.

* You can customize widget functionality (currencies, amounts, etc.) by adding and removing parameters in the JavaScript, whilst still preserving proper formatting.
  * All parameters can be found on the [off-ramp parameters](/widget/off-ramp/customization/parameters) page.

* For example, if we would like to display the widget with a default of selling *.05 BTC to EUR*, and set `lockAmount` to `true` in the parameters so that the user cannot modify the sell amount, we could modify the JavaScript like such:

  ```html off-ramp.html theme={null}
  <script>
    document.addEventListener("DOMContentLoaded", () => {
      const moonpaySdk = window.MoonPayWebSdk.init({
        flow: "sell",
        environment: "sandbox",
        variant: "overlay",
        params: {
          apiKey: "pk_test", // Replace with your MoonPay publishable test API key
          baseCurrencyCode: "btc",
          baseCurrencyAmount: ".05",
          defaultBaseCurrencyCode: "btc",
          quoteCurrencyCode: "eur",
          lockAmount: "true",
        },
      });

      // Open widget
      moonpaySdk.show();
    });
  </script>
  ```

### Step 4: Do a test transaction

* The first step of processing a test transaction using the MoonPay Off-Ramp is to make sure that `environment` is set to`"sandbox"`, as shown above in the example code. This puts your widget in test mode.
* Next, open up the widget, enter your email address, and log in.

<Frame>
  <img src="https://mintcdn.com/moonpay/Kzio-7fxRExSXZf_/images/widget/013fb3f-Screenshot_2023-10-27_at_5.57.08_PM.png?fit=max&auto=format&n=Kzio-7fxRExSXZf_&q=85&s=99bbae7103fcfb09b9c4c8ac3f54b37c" alt="Dashboard" width="3024" height="1784" data-path="images/widget/013fb3f-Screenshot_2023-10-27_at_5.57.08_PM.png" />
</Frame>

* You will be prompted to configure your Sell transaction. Use [our test credit card for off-ramp payouts](/widget/sandbox-testing#test-card-for-off-ramp-payouts) when prompted for a payout method.
* You'll eventually arrive at the below screen. Click on “View deposit details”.

<Frame>
  <img src="https://mintcdn.com/moonpay/Kzio-7fxRExSXZf_/images/widget/e123fcf-Screenshot_2023-11-08_at_3.59.16_PM.png?fit=max&auto=format&n=Kzio-7fxRExSXZf_&q=85&s=d690f844081a3e668b2e82ee32949a6c" alt="Dashboard" width="3024" height="1730" data-path="images/widget/e123fcf-Screenshot_2023-11-08_at_3.59.16_PM.png" />
</Frame>

* You will now see the below screen, prompting you to send the previously specified amount of cryptocurrency to a wallet on the corresponding blockchain. Click the “I’ve sent my crypto” button.

<Frame>
  <img src="https://mintcdn.com/moonpay/Kzio-7fxRExSXZf_/images/widget/e666794-Screenshot_2023-11-08_at_4.01.33_PM.png?fit=max&auto=format&n=Kzio-7fxRExSXZf_&q=85&s=13c14bdfbf59f15cb99a982d124b7fdc" alt="Dashboard" width="3006" height="1730" data-path="images/widget/e666794-Screenshot_2023-11-08_at_4.01.33_PM.png" />
</Frame>

* When successful, you will see green checks on the Pending, Processing, and Sent pages! ✅

## Completion

Congratulations, you have just integrated the MoonPay Off-Ramp 🎉

Any questions? Feel free to visit our [Help Center](https://support.moonpay.com/en/) to dig into our other resources or drop us a line!
