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
Each purchase needs a fresh CVC. Import a card once and store its
id. Before
each later purchase with that card, send the new CVC with Update the
CVC. MoonPay keeps a CVC for one hour.New customer
Returning customer
Connect the customer
Connect the customer. Then get their
access token with
client.getCredentials() and
pass it to your server.Import the card
Import a card the first time the customer pays with it. For a card you already
imported, skip to Update the CVC.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. Storedata.idagainst the customer so you can update the CVC for later purchases.200 OK: the customer already has this card. MoonPay returns the sameidand stores the new CVC. Retries are safe, and if you lose a card’sid, importing the card again returns it.
Errors
Update the CVC
When a returning customer pays with a card you already imported, ask them for
the CVC and send it with
PATCH /platform/v1/payment-methods/cards/{cardId}/cvc. Use the card id from
the import response as cardId. You don’t need to send the card number or
billing address again.Call it from your server through the same PCI proxy host, with the customer’s
access token. The token needs the payment-methods.create scope. MoonPay keeps
the CVC for one hour, so send it shortly before the purchase.Update the CVC
CVC update request body
CVC update responses
204 No Content: MoonPay stored the new CVC. The response has no body.
CVC update errors
Quote and buy
Get a quote with
paymentMethod: { type: "card", id }, then run the purchase.