Buy or sell any tokenized asset with USDC, in an API call
This guide will show you how to quickly buy or sell any tokenized asset (NFT) with USDC, using Crossmint’s headless APIs.
collectionId
ready.
orders.create
, orders.update
, and orders.read
scopes enabled. More info on creating API keys here.This Quickstart assumes that you'll be using the API Playground or cURL requests to make the API calls. This approach requires the use of a server-side API key.
If you would rather follow the quickstart while building a client-side app that makes requests to Crossmint directly from the browser, you must use a client-side API key. See the Server or Client Guide for more information.
To integrate in production/mainnet, you'll also need to complete account and collection verification. More information in the production launch guide.
Wallet
Crypto wallet supporting USDC - Metamask, Phantom, Coinbase Wallet, etc.
Testnet Balance
A small balance of USDC testnet currency in your wallet on the Base-sepolia network.
Get testnet USDC here:
The above faucet provides both USDC and USDXM. This quickstart uses USDC by default, but you can also use USDXM (see contract address below).
USDXM is a test token that represents USDC. It has the same behavior as USDC. In production, you’ll use real USDC instead.
Adding USDC to MetaMask:
0x036CbD53842c5426634e7929541eC2318f3dCF7e
0x14196F08a4Fa0B66B7331bC40dd6bCd8A1dEeA9F
Setup your Python environment
Clone the quickstart repo:
Navigate to the project directory and create a virtual environment:
Install the dependencies:
Set keys in .env
Set the following keys in the .env
file:
CROSSMINT_API_KEY
, COLLECTION_ID
are found from the Developer Console. See PrerequisitesPAYER_ADDRESS
is your wallet address that contains USDC.EMAIL_ADDRESS
is where you’ll receive your NFT in a new Crossmint wallet that you can access later.Create order with USDC payment
Run the application:
This will:
Receive Payment
serializedTransaction
returned in the previous step and paste it below.env
fileStatus of order
The code will poll for the status of the order until it is marked as complete. You should see it changing from “payment” to “delivery” and finally to “completed”.
You will also see the final order details, including the transaction hash, in your terminal.
Once the order is complete, you will receive an email with a link to the purchased item, which can be viewed in the Crossmint website.
You can also access your NFT by logging in to your Crossmint wallet at
crossmint.com with the email address you specified in the .env
file.
The order creation process involves sending a POST request to Crossmint’s API with the necessary payment and recipient details. Let’s break down the key components:
recipient: Specifies where to deliver the tokenized asset
email
: The email address where the tokenized asset will be delivered in a Crossmint wallet.
Instead of an email, a walletAddress
field can be used to deliver the asset to a specific wallet address.payment: Defines how the payment will be made
method
: The blockchain network (base-sepolia
for testnet)currency
: The payment currency (usdc
)payerAddress
: The wallet address that will send the USDC paymentlineItems: Specifies what is being purchased
collectionLocator
: Identifies the collectionThe API request:
The response includes:
clientSecret
: A unique token used for authenticating subsequent requests for this orderorder
: The order details including the order ID and statusFor more details on creating orders via the headless API, see the Create Order API Reference.
The order status polling process involves periodically checking the order’s status until it’s completed. Let’s examine how this works:
order_id
and client_secret
as parameterspayment
: Waiting for or processing paymentdelivery
: NFT is being deliveredcompleted
: Order is successfully completedThe 3-second polling interval helps prevent rate limiting while still providing timely updates. Adjust this value based on your needs.
For more details on polling for order status, see the Get Order API Reference.
Always implement proper error handling, retry mechanisms, and asynchronous polling in production environments to handle network issues or API interruptions.
Buy or sell any tokenized asset with USDC, in an API call
This guide will show you how to quickly buy or sell any tokenized asset (NFT) with USDC, using Crossmint’s headless APIs.
collectionId
ready.
orders.create
, orders.update
, and orders.read
scopes enabled. More info on creating API keys here.This Quickstart assumes that you'll be using the API Playground or cURL requests to make the API calls. This approach requires the use of a server-side API key.
If you would rather follow the quickstart while building a client-side app that makes requests to Crossmint directly from the browser, you must use a client-side API key. See the Server or Client Guide for more information.
To integrate in production/mainnet, you'll also need to complete account and collection verification. More information in the production launch guide.
Wallet
Crypto wallet supporting USDC - Metamask, Phantom, Coinbase Wallet, etc.
Testnet Balance
A small balance of USDC testnet currency in your wallet on the Base-sepolia network.
Get testnet USDC here:
The above faucet provides both USDC and USDXM. This quickstart uses USDC by default, but you can also use USDXM (see contract address below).
USDXM is a test token that represents USDC. It has the same behavior as USDC. In production, you’ll use real USDC instead.
Adding USDC to MetaMask:
0x036CbD53842c5426634e7929541eC2318f3dCF7e
0x14196F08a4Fa0B66B7331bC40dd6bCd8A1dEeA9F
Setup your Python environment
Clone the quickstart repo:
Navigate to the project directory and create a virtual environment:
Install the dependencies:
Set keys in .env
Set the following keys in the .env
file:
CROSSMINT_API_KEY
, COLLECTION_ID
are found from the Developer Console. See PrerequisitesPAYER_ADDRESS
is your wallet address that contains USDC.EMAIL_ADDRESS
is where you’ll receive your NFT in a new Crossmint wallet that you can access later.Create order with USDC payment
Run the application:
This will:
Receive Payment
serializedTransaction
returned in the previous step and paste it below.env
fileStatus of order
The code will poll for the status of the order until it is marked as complete. You should see it changing from “payment” to “delivery” and finally to “completed”.
You will also see the final order details, including the transaction hash, in your terminal.
Once the order is complete, you will receive an email with a link to the purchased item, which can be viewed in the Crossmint website.
You can also access your NFT by logging in to your Crossmint wallet at
crossmint.com with the email address you specified in the .env
file.
The order creation process involves sending a POST request to Crossmint’s API with the necessary payment and recipient details. Let’s break down the key components:
recipient: Specifies where to deliver the tokenized asset
email
: The email address where the tokenized asset will be delivered in a Crossmint wallet.
Instead of an email, a walletAddress
field can be used to deliver the asset to a specific wallet address.payment: Defines how the payment will be made
method
: The blockchain network (base-sepolia
for testnet)currency
: The payment currency (usdc
)payerAddress
: The wallet address that will send the USDC paymentlineItems: Specifies what is being purchased
collectionLocator
: Identifies the collectionThe API request:
The response includes:
clientSecret
: A unique token used for authenticating subsequent requests for this orderorder
: The order details including the order ID and statusFor more details on creating orders via the headless API, see the Create Order API Reference.
The order status polling process involves periodically checking the order’s status until it’s completed. Let’s examine how this works:
order_id
and client_secret
as parameterspayment
: Waiting for or processing paymentdelivery
: NFT is being deliveredcompleted
: Order is successfully completedThe 3-second polling interval helps prevent rate limiting while still providing timely updates. Adjust this value based on your needs.
For more details on polling for order status, see the Get Order API Reference.
Always implement proper error handling, retry mechanisms, and asynchronous polling in production environments to handle network issues or API interruptions.