WDK logoWDK documentation
MoonPayGuides

Get Started

Install the package and initialize MoonPayProtocol with your wallet and keys.

This guide covers installation and initializing the protocol. You need Node.js, npm, and MoonPay API keys from your MoonPay dashboard.

Installation

Run the following to install @tetherto/wdk-protocol-fiat-moonpay:

Install with npm
npm install @tetherto/wdk-protocol-fiat-moonpay

Initialize MoonPayProtocol

You can create a fiat ramp client with new MoonPayProtocol(account, config):

Construct MoonPayProtocol
import MoonPayProtocol from '@tetherto/wdk-protocol-fiat-moonpay'

const moonpay = new MoonPayProtocol(walletAccount, {
  apiKey: process.env.MOONPAY_PUBLISHABLE_KEY,
  environment: 'sandbox'
})

The package does not accept a MoonPay secret key. Omit signUrl to return unsigned widget URLs, or provide a callback that sends the URL to an authenticated backend. Keep the signing secret on that backend.

See Configuration for secure URL signing, cacheTime, and related options.

Next Steps

On this page