Pay with Card - Memecoins
Create a fully customized memecoin checkout experience that accepts credit cards
Introduction
This guide will show you how to accept credit card payments using Crossmint’s Embedded Checkout and Headless Checkout API for memecoin sales. You’ll learn how to:
- Set up credit card payments for Solana memecoin purchases in JavaScript
- Implement a checkout UI using Embedded or Headless Checkout
- Track order status and delivery
Important Notes
Supported Memecoins
Crossmint runs compliance checks on all tokens to ensure they do not qualify as securities or currencies under applicable regulations. Transactions for tokens that are determined to be too similar to securities or currencies will fail.
Token Format
Currently, memecoin checkout only supports Solana network. - Token Format: solana:${tokenMintHash}
- Examples:
- TRUMP:
solana:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
Delivery to External Wallets Only
Memecoin checkout only delivers memecoins to EOAs (Externally Owned Accounts), not Crossmint supported delivery solutions, such as on-the-fly wallet creation (both Crossmint custodial wallets and smart wallet), delivery Twitter handle, etc.
Merchant of Record
Crossmint remains the merchant of record for all transactions. Your buyers will still receive delivery receipts and transaction confirmations from Crossmint.
Prerequisites
Get API Keys
Get your API keys from the Crossmint Console
Token Specification
Currently, memecoin checkout only supports Solana network.
- Token Format:
solana:${tokenMintHash}
(tokenMintHash is commonly known as contract address, CA, or mint hash) - Examples:
- TRUMP:
solana:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
- TRUMP:
If you want to check if a memecoin is supported by Crossmint follow our supported tokens API
External Prerequisites
- A Solana wallet address to deliver the purchased memecoins
Option 1 - Embedded Memecoin Checkout
The fastest way to start selling memecoins is to adapt our embedded checkout solution to use fungibles.
Important Parameters
Before implementing the checkout, note these key parameters:
- maxSlippageBps: Optional slippage tolerance (default provided if not specified)
- receiptEmail: Required for delivering payment receipts
- executionParameters.mode: Set to “exact-in” for memecoin purchases (specifies exact USD amount to spend). Exact-out is for NFT’s, exact-in is for fungibles.
Integration Steps
This guide will start from scratch with an empty Next.js application. You'll install the required @crossmint/client-sdk-react-ui
dependency and add the embedded checkout component. To get started:
Set up the Project
Create a new Next.js application
If you see this message, type y
and press Enter
to proceed:
Name your app `crossmint-embedded-checkout-demo` and accept the default options
Change into the directory created in previous steps
Install @crossmint/client-sdk-react-ui
Open the project in your preferred code editor
Memecoin Embedded Integration
Next, we will set up a project file with Crossmint’s embedded checkout to accept memecoin purchases.
Add environment variables
Create .env.local
in your project root:
Create the checkout page
Create /src/app/page.tsx
with:
Run your app
Visit http://localhost:3000
to see your checkout!
Test your app
Memecoin purchases are only supported in production, so pay with credit card in a small amount to test the flow.
Here’s how your embedded checkout will look after implementation:
🎉 Congratulations! You’ve successfully set up your embedded memecoin checkout. Check out the Next Steps section below to learn how to customize your integration.
Option 2 - Headless Memecoin Checkout
The headless checkout API allows complete control over your checkout experience, including:
- Custom UI components and styling
- Custom payment flow sequences
- Integrated analytics and tracking
- Custom error handling and retry logic
- Branded confirmation pages
Create an Order
The first step in the headless checkout process is to create an order. An order is an object datastructure, that represents an intent to purchase in Crossmint's systems. This guide will create a basic order, and then update it with required info step-by-step.
You can also create the entire order in one API call if the necessary information is available at the time of order creation. This can be used for custom "one-click-checkout" experiences, should you wish to make them.
POST
https://staging.crossmint.com/api/2022-06-09/orders
Refer to the complete create order API reference here.
Use the javascript code snippet below to create a starting point for your order. Alternatively, use the API playground to explore and create your own order.
Note the following parameters in the request body:
maxSlippageBps
: Optional, or else default autogenerated slippage will be applied.receiptEmail
: Required for credit card payments to deliver receiptexecutionParameters.mode
: The execution method for the order. Exact-out is for NFT’s, exact-in is for fungibles.
Render the Stripe Payment Element
The key
property on the Elements
component is important to re-render the payment element if either the
stripeClientSecret
or stripePublishableKey
change, as these fields can't be 'live' updated
The Stripe Payment Element will appear as shown below: a
Submit Payment
The Stripe Payment Element does not handle submitting the payment, so you will also need to create your own submit button.
First, at the top of the file, update the import for @stripe/react-stripe-js
to be:
Then, update the SubmitButton
component with the following code:
At this point, your app should look similar to the one displayed below (fill in the 2 input fields with the data you recieved in order.payment.preparation
in order to see the live Payment Element).
Poll for Status Updates
After making the payment via whichever payment method, you'll need to poll the Get Order API to check on the delivery status and present this info to your user.
Refer to the complete get order API reference here.
GET
https://staging.crossmint.com/api/2022-06-09/orders/<orderId>
Example response from the Get Order API:
Understanding the Code
Quote Expiration
Price quotes are valid for 30 seconds. After expiration, you’ll need to request a new quote from the headless checkout API
Slippage
Crossmint applies the slippage specified in your API request via executionParameters.slippageBps. If not provided, Crossmint will use the default slippage configuration from Crossmint’s provider
Parameters Explained
The order creation request includes several important parameters:
Payment Object
method
: Set tostripe-payment-element
for credit card paymentscurrency
: Set tousd
for US Dollar paymentsreceiptEmail
: Required for credit card payments to deliver receipt
Line Items Object
tokenLocator
: Specifies the memecoin token address in the formatsolana:tokenAddress
callData
:amount
: Amount to purchase in USDslippageBps
: Set to “500” for 5% slippage tolerance. If not provided, the default slippage will be applied from the available liquidity provider.
Order Lifecycle
The order goes through several phases: Learn more about order phases in the headless checkout guide
A summary of the phases is below:
-
Quote Phase (30-second validity)
- Initial price quote generated
- Requires recipient information to proceed
-
Payment Phase
- Process credit card payment via Stripe
-
Delivery Phase
- Purchase memecoin with USDC
- Apply specified slippage tolerance
- Send transfer transactionsaction to recipient wallet
-
Completion
- Order marked as completed
- Receipt email sent to recipient
- Memecoins have been delivered to the recipient wallet
If the quote expires (after 30 seconds), you’ll need to create a new order to get updated pricing. You can choose the UX flow to handle this.
Next Steps
Customize UI
Learn how to customize the checkout experience
Handle Webhooks
Implement webhook handling for order updates
FAQ
Was this page helpful?