Architecture

MoonPay's API-driven swap flow allows you to provide your own swaps UI while still leveraging MoonPay's full swap functionality.

Your UI can allow your customers to select the currencies to exchange and respective amounts, and see the resulting quotes which they can then accept to place a swap with MoonPay.

You can use our API endpoints to drive your UI. For example, you can list the available swap pairs, get quotes for a selected pair and execute quotes.

Swaps are executed by you, on behalf of a MoonPay customer. So, before a quote can be executed, the customer needs to authenticate and KYC with MoonPay. For this you need to embed our widget that initiates an authentication and KYC journey. The widget will provide you with a customer token to use when retrieving and executing the quote.

Components for Swap integrations

ComponentFeatures
Web SDKsParameters to pre-fill cryptocurrency, amount, user email, etc.
Includes communication layer that allows you to receive the customer token.
Mobile SDKsSDKs for iOS and Android apps
MoonPay APIGet swap pairs
Get swap quote
Show transaction history
WebhooksGet transaction updates

High-level diagram

This diagram shows a basic swap flow and the components required for implementation. We recommend using our API and webhooks to provide helpful context in your app, including minimum / maximum purchase amounts, quotes, and transaction history.