Prepare your platform connection
The Browser Pay flow needs these scopes:
events:read and events:consume support recovery after user actions. offline_access enables refresh tokens. Add wallet:setup if the platform changes a user’s default card. The scopes registered for the OAuth client must include every scope requested by users. See the tool references for per-tool requirements.
OAuth client registration and Browser Pay public-key registration are separate steps. Submit the encryption public key through your Clink contact; it is not a DCR request parameter. Wallet queries do not require credential decryption.
Connect each user
Implement Authorization Code with PKCE (S256) using the shared OAuth guide. Bind the authorization callback to the user who started the connection, and use that user’s access token for their MCP requests. Maintain and refresh tokens separately for each user.
The OAuth connection grants access to Clink tools. A purchase authorization defines what the Agent can spend with a payment card. Connecting a user does not by itself authorize a purchase. When passkey verification is required, the platform presents the user action link and waits for completion. See Wallet Service: Passkeys and purchase authorization.
The Clink Skill installs a Host connection. For business operations, read the connected MCP server’s current rules from clink://skill/rules; if resources are unavailable, call get_skill_manifest with include_rules: true. Follow the server’s current rules when updating your integration.
Run your first wallet call
After OAuth returns a user access token withwallet:read, use this read-only check to verify the connection. It discovers the tools and reads the wallet without starting a payment. The example uses the official MCP TypeScript SDK v2.
Node.js example: connect and read the wallet
Node.js example: connect and read the wallet
Use Node.js 20.19 or later. In an example directory, install the client:Supply
CLINK_USER_ACCESS_TOKEN through your runtime environment; it must belong to the connected user and the selected environment. CLINK_MCP_URL is optional and defaults to UAT. Save the following as check-wallet.mjs:connected: true, walletReadable: true, and the current cardCount. A count of 0 is a successful wallet read with no cards, not a connection failure. For a long-running platform, use your per-user token refresh flow instead of the fixed token in this connection check.
Complete a Browser Pay purchase
After the user connects through OAuth and requests a purchase, follow the checkout flow below. These diagrams show the encrypted-credential path with the platform public key already configured.- Payment flow
- When user action is required
When a valid purchase authorization covers the payment,
get_credential can return the credential directly.- User action: preserve the checkout and setup Operation, show the returned link, and resume only after reading the updated state.
- Payment credential: use
credential.carddirectly or apply the decryption example tokeyandpayload. Preserve the issuing Operation’s payment identifiers before submission. - Merchant result: operate the checkout browser and report the observed outcome. The complete amount, card-selection, and retry rules are in Browser Pay.
Purchase and recovery orchestration
Purchase and recovery orchestration
This pseudocode shows how the calls fit together. Take checkout facts from the final merchant page:
callTool represents an MCP call whose isError and structured output have been checked. Saving context, showing links, decryption, and merchant browser control are platform responsibilities, not additional Clink APIs.amount is in minor units, and paymentInstrumentId is included only when the user selected a card. For setup responses without a user link, follow the returned action as described in Browser Pay. After setup, keep the same checkout facts and selected card; do not pass the setup Operation ID to get_credential.Use payment identifiers from resources, or the corresponding credential payload fields. If they cannot be read, recover them from the issuing Operation before continuing. Include paidAmount and currency together when the merchant confirms the paid amount. See the response examples for the full shapes and report parameters.Preserve the payment context
An
UNKNOWN result means payment was submitted but the outcome could not be observed. Reconcile it through the same payment context and report the final result before the returned report_deadline; do not immediately start another payment. See operation recovery and the Browser Pay API.
Validate the integration
Before rollout, verify these cases in the configured environment:- Two users connect to the same OAuth client and each sees only their own wallet and operations.
- A valid purchase authorization returns a credential; a missing authorization produces the required user action and can be resumed.
- A response encrypted to the registered platform key decrypts using the example and produces payment fields usable in the merchant form.
- Success, failure, an unsubmitted payment, and an unknown result are reported with the correct identifiers.
- Returning from user authorization or recovering after a timeout continues the existing operation without blindly submitting another payment.