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 theiruser_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 session2
Show the checkout
Hosted: open or relay To present a wallet-only sheet (just the Apple Pay button, no card form),
append
checkout_url; the user pays in their browser.Embedded: load checkout_url in a WKWebView (iOS) or Android WebView.
On iOS 16+ the Apple Pay button renders in-app and pops the native Apple
Pay sheet — Apple Pay on the Web is supported in WKWebView but not in
SFSafariViewController, so use a WKWebView. Google Pay works in a modern
Android WebView, and card is always available. No domain verification is
needed on your side.&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 as advisory. The embedded page also navigates to
/fund/success when payment completes, which you can observe to close your
WebView.→ Get a funding sessionStatus 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.