NFT Checkout
This guide uses thirdweb Engine to sell NFTs with credit card:
- A buyer pays with credit card.
- Upon payment, your backend calls Engine.
- Engine mints an NFT to the buyer's wallet.
The buyer receives the NFT without requiring wallet signatures or gas funds.
Prerequisites
- A thirdweb client ID and secret key from the API Keys page
- An Engine instance
- A backend wallet with currency to pay for gas
- An access token for your Engine instance
- A deployed NFT contract that can be claimed by the backend wallet
- A Stripe account on test mode (no real payments will be made)
Frontend: Add Connect Wallet and credit card form
Use <ConnectWallet>
to prompt the buyer for their wallet address. The buyer provides their credit card details and selects Pay now to send payment details directly to Stripe.
Backend: Get a Stripe client secret
POST /api/stripe-intent
returns a client secret which is needed to display the credit card form.
Backend: Configure the Stripe webhook
POST /api/stripe-webhook
calls Engine to mint an NFT when a buyer is successfully charged.
Configure Stripe webhooks
Navigate to the Stripe webhooks dashboard (test mode) and add the /api/stripe-webhook
endpoint and send the charge.succeeded
event.
Try it out!
Here’s what the user flow looks like.
The buyer is prompted to provide their credit card.
They provide their card details.
Tip: Stripe testmode accepts
4242 4242 4242 4242
as a valid credit card.
They are informed when their payment is submitted.
Full code example
The code above is simplified for readability. View the full source code →
FAQ
Can I accept different payment methods?
Yes! You provide the payment provider and can accept different currencies (EUR, JPY), digital wallets (Apple Pay, Google Pay), bank payments (ACH, SEPA), local payment methods (UPI, iDEAL), and more.
How is thirdweb NFT Checkout different?
thirdweb Checkout is a full solution that detects fraud, provides chargeback liability, accepts multiple payment methods including cryptocurrency, includes a prebuilt checkout UX, and more.