Skip to main content
Each connected user has an Agentcard wallet that backs the cards they create. When the balance is short, you create a funding session and hand the user a checkout link — they pay with Apple Pay, Google Pay, or card, and the funds land in their wallet. You build the trigger and (optionally) host the checkout inside your app; Agentcard runs the payment. Funding reuses the user’s completed identity verification — there’s no separate verification step inside checkout. A user who isn’t verified yet is refused with kyc_required; run step 2 first, then fund. Every call is made from your backend with your platform access token, and names the user with the user_id you received when they connected. Each step links to its page in the API reference — full parameters, responses, error codes, and a live playground.

Instructions for your agent

Paste this into your coding agent to implement wallet funding. It assumes the user is already connected and identity-verified (you have their user_id).
Instructions for your agent

The flow

1

Create a funding session

From your backend, POST /api/v2/wallet/fund with the user_id and amount_cents. Choose link_type: hosted (default) returns an Agentcard-hosted page you can relay anywhere; embedded returns an in-app link you load in a WebView. If the user isn’t verified you get 422 kyc_required — send them through identity verification first. Read min_amount_cents / max_amount_cents off 422 amount_out_of_range rather than hardcoding limits.Create a funding session
2

Show the checkout

Hosted: open or relay checkout_url; the user pays in their browser.Embedded: branch on the response’s checkout_style.crossmint_sdk — render the response’s embed_url with Agentcard’s iOS component and the real native Apple Pay sheet slides up in-app — no domain verification, no Apple merchant ID or entitlements, and no payment-provider constants in your code (embed_url is built server-side and provider-opaque, so the rail behind it can change without you re-integrating):
The component renders a black wallet-button pill (label is Apple-mandated); one tap opens the native sheet. Alternatively, the crossmint object (order_id, client_secret, client_api_key, api_environment) boots Crossmint’s own checkout SDKs (Swift / Kotlin / React Native) if you prefer their full checkout component — native Google Pay rides the Kotlin/React Native path. checkout_url remains a plain web fallback if you can’t ship either.cb_onramp — load checkout_url in a WKWebView and register a script message handler named cbOnramp; the page renders the Apple Pay button in-app and posts lifecycle events (load_success, commit_success, cancel, …) to your handler.web (or any unrecognized style) — open checkout_url in a browser context. To present a wallet-only sheet (just the Apple Pay button, no card form), append &only=apple_pay to the checkout_url fragment.Mint an embedded session only when the user has actually initiated payment, render it immediately, and never relay it — link unfurlers can consume it.
3

Confirm completion

Poll GET /api/v2/wallet/fund/{session_id} until completed. That endpoint is the source of truth for money; treat any client-side signal (SDK callbacks included) as advisory. The embedded web page also navigates to /fund/success when payment completes, which you can observe to close your WebView. client_secret is returned once at create time and never again — if your app loses it, create a new session.Get a funding session

Status values

Testing in test mode

With a test-mode credential the whole flow runs against a test environment — sandbox clients create TEST orders that are never charged, so you can exercise create → checkout → completed end to end (including the embedded WebView flow) before switching to live keys. On a physical device, cards must be in the platform wallet; simulators can’t show the Apple Pay sheet.