Checkout API
Use the Checkout API to take payment from a user and mint an NFT
Enterprise Only
This API is for enterprise clients only.
White Label / Enterprise Access Required
Crossmint Whitelabel is offered as an enterprise solution and requires evaluation of your use case before approval. Reach out to sales support to get started.
Crossmint's Whitelabel API allows you to accept payment from a user and mint an NFT with the /checkout/mint
endpoint.
Here's an example flow:
- Developer builds a buy button that when clicked calls
api/checkout/mint
. api/checkout/mint
returns a Checkout URL. The developer will redirect the user to this URL in order to collect customer payment details.- After submitting payment details, the user will be redirected to the
continue
orcancel
URL passed to the API.
API Details
Basic Examples:
import fetch from 'node-fetch';
const body = {
"clientId": "085f0f5a-9948-11ec-b909-0242ac120002",
"userId": 41232,
"collection": {
"title": "A great collection",
"description": "This is a fantastic collection of NFTs",
"photo": "https://i.picsum.photos/id/542/200/300.jpg?hmac=qD8M4ejDPlEc69pGT21BzB7CDiWOcElb_Ke7V8POjm8"
},
"mintConfig": {
"totalPrice": "0.08",
"_count": 3,
// if your contract requires additional parameters, they'll go here.
},
"redirect": {
"continue": "https://google.com/continue",
"cancel": "https://google.com/continue",
},
};
const response = await fetch(
'https://www.crossmint.com/api/v1-alpha1/checkout/mint',
{
method: 'POST',
body: JSON.stringify(body),
headers: {
'X-PROJECT-ID': <YOUR_PROJECT_ID>,
'X-CLIENT-SECRET': <YOUR_CLIENT_SECRET>
}
}
);
const data = await response.json();
const checkoutURL = data.checkoutURL;
import fetch from 'node-fetch';
const body = {
"clientId": "085f0f5a-9948-11ec-b909-0242ac120002",
"userId": 41232,
"collection": {
"title": "A great collection",
"description": "This is a fantastic collection of NFTs",
"photo": "https://i.picsum.photos/id/542/200/300.jpg?hmac=qD8M4ejDPlEc69pGT21BzB7CDiWOcElb_Ke7V8POjm8"
},
"mintConfig": {
"totalPrice": "0.08",
"quantity": 3,
// if your contract requires additional parameters, they'll go here.
},
"redirect": {
"continue": "https://google.com/continue",
"cancel": "https://google.com/continue",
},
};
const response = await fetch(
'https://www.crossmint.com/api/v1-alpha1/checkout/mint',
{
method: 'POST',
body: JSON.stringify(body),
headers: {
'X-PROJECT-ID': <YOUR_PROJECT_ID>,
'X-CLIENT-SECRET': <YOUR_CLIENT_SECRET>
}
}
);
const data = await response.json();
const checkoutURL = data.checkoutURL;
import fetch from 'node-fetch';
const body = {
"clientId": "085f0f5a-9948-11ec-b909-0242ac120002",
"userId": 41232,
"emailTo: "[email protected]",
"mintTo": "<WALLET_ADDRESS>", // optional, can be omitted
"paymentMethod": "fiat",
"mintConfig": {
"type": "candy-machine",
"totalPrice": "0.0001",
"environment": "staging" // omit if in production
},
"collection": {
"title": "A great collection",
"description": "This is a fantastic collection of NFTs",
"photo": "https://i.picsum.photos/id/542/200/300.jpg?hmac=qD8M4ejDPlEc69pGT21BzB7CDiWOcElb_Ke7V8POjm8"
},
"redirect": {
"continue": "https://google.com/continue",
"cancel": "https://google.com/continue",
},
};
const response = await fetch(
'https://www.crossmint.com/api/v1-alpha1/checkout/mint',
{
method: 'POST',
body: JSON.stringify(body),
headers: {
'X-PROJECT-ID': <YOUR_PROJECT_ID>,
'X-CLIENT-SECRET': <YOUR_CLIENT_SECRET>
}
}
);
const data = await response.json();
const checkoutURL = data.checkoutURL;
Advanced Checkout Options:
mintConfig
mintConfig
If the mint function in your smart contract requires non-standard parameters, here's where you will specify them. Arguments included here will be included when we call your contract's mint function.
mintTo
mintTo
By default, the NFT will be minted into the Crossmint custodial wallet. If, however, you'd like to specify a different destination wallet, this is where you can do so.
paymentMethod
paymentMethod
We accept fiat payments, as well as ETH and SOL for NFT sales across all chains. Use this parameter to specify the currency to use.
If you'd like more information, check out our official guide on cross-chain payments.
whPassThroughArgs
whPassThroughArgs
If you have a webhook configured, you may want to pass along additional information for your own bookkeeping. This field can be in any format you'd like: number, string, object are all valid here, as you'll handle parsing this within your own code.
For example, if you'd like to keep track of referral codes, or have your own identifiers for NFTs, this would be where to provide that information.
Updated about 2 months ago