Skip to main content
Send a card to MoonPay from your server and get a card id. Then quote and buy with it, as in Pay with card. See the Going Live section for requirements you must meet before taking this integration to production.

Prerequisites

  • Card import enabled on your MoonPay account. Contact your MoonPay account team to enable it.
  • A PCI-compliant server to send card data from.
  • A connected customer.

How it works

Import the card before every purchase, even when MoonPay already has it. Each purchase needs a fresh CVC.

New customer

Returning customer

1

Connect the customer

Connect the customer. Then get their access token with client.getCredentials() and pass it to your server.
Hold the access token in memory only. Don’t log it or write it to disk.
2

Import the card

Call POST /platform/v1/payment-methods/cards from your server, with the customer’s access token as a Bearer token. The token needs the payment-methods.create scope.Send the request to MoonPay’s PCI proxy, not api.moonpay.com. Use the host that matches the access token:We recommend sending the customer’s deviceIp and userAgent. MoonPay uses them for fraud checks.

Request body

Responses

  • 201 Created: MoonPay added the card.
  • 200 OK: the customer already has this card. MoonPay returns the same id and stores the new CVC. Retries are safe.
While lastMicroAuthVerification.status is started, pending or expired, the card can’t be used for a purchase.

Errors

3

Quote and buy

Get a quote with paymentMethod: { type: "card", id }, then run the purchase.