Prerequisites
- Verified order intent — follow Create an Agent Card and wait for a rail with
status: "active". - Crossmint API key — a client-side key with the
order-intents.readandorder-intents.credentialsscopes. To recover fromORDER_INTENT_CVC_RECOLLECTION_REQUIREDwith the hosted CVC step, the same key also needspayment-methods.readandpayment-methods.update. In staging, all scopes are included by default. - User JWT — use the JWT for the user who owns the order intent.
Mint a Card-Network Credential
Find theagentic-token rail you want to use and confirm that it is active and supports card credentials. Other rails can remain pending. Send the selected rail’s rail and provider values back in the request.
This example continues from the merchant-scoped order intent created in the previous guide, so the credential request does not repeat the merchant:
Open Order Intents
IforderIntent.merchant is absent, include a merchant in every credential request:
Mint an Encrypted Card
When the order intent’srails array contains an encrypted-card entry, the response cannot contain a network-issued one-time card. Instead, the user’s saved card is encrypted inside the PCI-compliant vault to a public key that you control, and Crossmint returns the ciphertext. Only the holder of the matching private key can read the card.
Generate a Key Pair
Generate an RSA key pair of at least 2048 bits for theRSA-OAEP-256 algorithm. Keep the private key wherever the agent will decrypt the card; only the public key is sent to Crossmint.
Request the Encrypted Card
Send the public key as a JWK with only thekty, n, and e members. The request takes the same amount and optional merchant as the other rails; the encrypted-card rail has no provider:
id, amount, and expiresAt fields as a card-network credential. The id is issued by Crossmint. expiresAt is the earlier of two deadlines: the end of the window in which the vault still holds the card’s security code, and the order intent’s own expiresAt. After it passes, mint again for what you still need; the amount already minted does not come back. If the security-code window is what ended, the rail reads pending_cvc_recollection and the user re-enters the CVC first; if the order intent itself expired, create a new one:
Decrypt the Card
The JWE usesRSA-OAEP-256 for key encryption and A256GCM for content encryption. Decrypt it with your private key using a JOSE library. The plaintext is a JSON object with the same fields as a card-network credential:
amount from the order intent even if the card is never charged, and the order intent refuses a mint above amount.available. The card network does not enforce the allowance, so your agent must keep each purchase within the amount it minted and the order intent’s merchant.
Encrypted Card Errors
To make a retry safe, send an
Idempotency-Key header (1 to 255 characters) with the request. A second call with the same key never consumes the amount again: while the first is unanswered it is refused, and after a successful mint it returns ORDER_INTENT_CREDENTIAL_ALREADY_ISSUED. Without the header every call is a new mint.
A malformed request, such as a publicKey whose kty is not RSA or whose encoded n is shorter than 342 base64url characters, fails schema validation before the vault is called and returns a 400 without an order-intent error code. Other unusable RSA keys can reach the vault and return ORDER_INTENT_INVALID_PUBLIC_KEY.
List Order Intents
List every order intent owned by the authenticated user:GET /api/unstable/order-intents/{orderIntentId} when you only need to refresh one order intent.
Common Gotchas
The request amount must fit the available balance
The request amount must fit the available balance
Use the same currency as the order intent and keep the requested value at or below
amount.available.Creating a credential spends allowance capacity
Creating a credential spends allowance capacity
Do not retry a credential request blindly. Each successful mint is a new credential and consumes the requested amount.
A pending rail cannot mint credentials
A pending rail cannot mint credentials
Complete allowance verification for the rail you selected and fetch the order intent again before minting. You do not need to verify unrelated rails.
Open order intents require a merchant
Open order intents require a merchant
If the order intent was created without
merchant, include one in every credential request. If the merchant was set at creation, omit it when minting, or repeat it exactly: a different merchant is refused. This applies to every rail, encrypted-card included.Encrypted cards differ only in the credential block
Encrypted cards differ only in the credential block
With
rail: "encrypted-card", send amount, an optional merchant, and credential.format with credential.publicKey. Do not send provider. Requests with unknown fields are rejected.Next Steps
Cancel Card Access
Cancel an order intent or delete a saved card
Cards Quickstart
Run the complete flow in the reference app

