How to issue debit cards that spend stablecoins from non-custodial wallets using Bridge Cards
Bridge Cards lets your app issue debit cards that spend stablecoins directly from a non-custodial wallet. When a cardholder makes a purchase, Bridge pulls funds from the linked wallet via an onchain approval.Before starting, set up a Bridge account and create Bridge customers by following the Bridge onramp and offramp recipe.This recipe covers:
Provisioning a card account
Setting up a token approval
Handling card transaction webhooks
Setting up a Bridge account with Privy
Set up Bridge onramp and offramp flows with Privy.
Bridge Cards documentation
Official Bridge documentation for non-custodial card issuance.
Your app provisions a card account by sending a POST request to /customers/{customerID}/card_accounts. Specify the wallet address, stablecoin, and set crypto_account type to standard for a non-custodial wallet.Include an Api-Key header for authentication and an Idempotency-Key header.
A wallet can only be tied to one card account. Bridge does not support issuing multiple cards that
spend from the same wallet.
Solana
EVM
For Solana, do not specify the associated token account
address. Bridge automatically derives it from the owner address and currency. For example, if the
account owner address is BDkZQv1DqS7RJG5MZjVEP8FbN9Xvpf5b67kpi3765rQb, Bridge derives the
USDC token account GXaRe925ejuzX3KZdtLPJ8fpnudzhdk9eXDxNSEdro49 automatically.
On Solana, Bridge submits an onchain transaction to register the program delegate address for the specified crypto_account address after creating the card account.
Provision the card account before setting up the token approval. This ensures Bridge ties the
address to the customer before your app submits any approvals onchain.
After provisioning the card account, the wallet must approve Bridge’s smart contract to pull funds during card transactions. Bridge provides a consolidated version of the Solana delegate approval logic in a GitHub Gist.
Add an instruction that approves Bridge’s card program to spend from the ATA. Bridge
assigns the MERCHANT_ID to your developer account during onboarding.
Submit the transaction using Privy. Pass sponsor: true to enable
Solana gas sponsorship, which handles the fee
payer and recent blockhash automatically.The result is a delegate approval resembling this transaction.
Submit a standard ERC-20 approve call to allow the Bridge issuer contract to spend from the
wallet.
The card issuer contract address is specific to your developer account and differs from the main
contract listed in the chain table above. Bridge provides this address during onboarding.
The card is now ready to use. When a cardholder makes a purchase, Bridge publishes webhook events for both the card network authorization and the onchain transaction.Bridge submits transactions onchain at the time of card authorization, but they complete asynchronously. This results in two webhook events:
Bridge publishes this event seconds later when the onchain transaction confirms. It includes crypto_details with the chain, amount, and transaction hash:
Bridge rejects an authorization if the onchain approval is inactive, the approved amount is
insufficient, or the wallet lacks funds. Incremental authorizations trigger additional onchain
transactions to cover the extra charge.