- Payment card. The current wallet response’s
agent_pay_supportindicates whether the card supports Agent Pay. The merchant or issuer may still decline this payment. - Merchant checkout page. The Agent can read the final total, fill the card form including embedded payment fields, submit payment, and view the merchant’s payment or order result.
- User verification. The user can complete any verification the bank requires, such as 3-D Secure or a one-time code.
- Main payment flow
- When user action is required
When a valid purchase authorization covers this payment,
get_credential can return the credential directly. Use credential.card as provided; decrypt only when the response contains key and payload.NOT_SUBMITTED; if it was submitted but the result cannot be confirmed, report UNKNOWN.
1. Read the final checkout amount
Use the final total shown on the merchant checkout page, including shipping and tax. Do not use the product list price, and do not treat the user’s maximum budget as the payment amount. Obtain contact and delivery details from the user or their merchant account. Select the website’s card payment option and disable any option to save payment details. If the user named a specific wallet card, obtain itspaymentInstrumentId from a fresh get_account_state response and check agent_pay_support: true. Otherwise, omit the card selector to use the default card.
2. Get the payment credential
The following is atools/call request. For a checkout total of USD 12.50, send amount: 1250:
wallet:read, payment:execute, instruction:read, and instruction:write.
Clink checks the payment card and matches an active purchase authorization. If an existing authorization covers this payment, the call can return the credential immediately. Otherwise, it can start a one-time authorization for the current checkout. You do not need to list or create purchase authorizations before every Browser Pay call.
Handle the actual response:
Read the action details from the structured response instead of inferring them from the label:
next_action.typeis the action category (REDIRECT_USERorSETUP_REQUIRED).next_action.params.redirect_kindexplains the reason for a redirect, such asPASSKEYorPAYMENT_METHOD_SETUP.next_action.params.setup_kindexplains the reason for setup, such asDEFAULT_CARDorPURCHASE_INSTRUCTION.next_action.params.resumabletells you whether the original checkout request can be retried after setup. Preserve the original checkout facts either way.next_action.params.actoridentifies who opens the link. TreatUSER_DEVICE_ONLYas a user-device action.
actor: "USER_DEVICE_ONLY", the user opens the link on their own device. The Agent must not open or preview it in its own browser. After presenting a Passkey or card setup link, wait for the same setup Operation:
events:read events:consume; also request offline_access when the platform needs a Refresh Token. Clink configures each platform’s scopes according to its enabled capabilities. See How to integrate MCP.
Once setup is complete, call get_credential again with the checkout facts. Do not pass the setup operationId. If the user selected a card for this checkout, keep the same paymentInstrumentId on every call. If the user chose to change the default card, call set_default_card first, then retry without the card selector.
Opening a link does not mean authorization is complete. If the response still requires action, follow the current next_action.
3. Read or decrypt the credential
Handle the actual returned shape rather than assuming every client receives the same result:
Cloud platforms configure their public key by contacting Clink offline. See Register an RSA public key.
How payment credentials are protected

key and payload, the credential is additionally encrypted with the platform’s public key. Decrypt it with the matching private key to read the card fields. This layer protects credential delivery; the purchase authorization confirmed with a Passkey determines the purchase scope. A response that returns credential.card directly is also subject to the authorization scope and credential expiry.
Keep payment identifiers
Keep these identifiers for reporting the result:orderId identifies Clink’s payment order; it is not the merchant’s order number. If the merchant returns an order number, keep that merchant order number separately.
A
get_credential Operation with status: "SUCCEEDED" means the credential was issued. It does not mean the merchant has been paid. get_operation never returns the credential and cannot independently verify the merchant’s payment result.get_credential.amount and confirm_result.paidAmount use minor currency units; the credential payload’s amount uses major currency units. For example, USD 12.50 is 1250 and 12.50 respectively. Convert according to the currency’s precision; do not multiply every currency by 100.
4. Fill and submit the merchant payment
Fill the returned card number, expiry, and security code into the card fields on the current checkout page, including payment provider fields embedded in the page. Use the expiry format the form requires. Use the returnedcardholderName and billingAddress when present; if billing information is missing, ask the user for it instead of inventing it.
Use the credential within the validity period it carries: dynamicDataExpiration in the decrypted card is authoritative, and the response sends no deadline.
Recheck the total before submitting:
- Total unchanged: submit and check the merchant’s result. If 3-D Secure or a one-time code is required, the user completes it.
- Total changed: do not submit the old credential. Report
NOT_SUBMITTEDwithfailureReason: "AMOUNT_CHANGED", then get a credential for the new total within the user’s authorization.
credential.display to describe the card to the user.
5. Report the observed result
Callconfirm_result to report this Browser Pay payment using the identifiers kept in step 3. The following example reports an observed successful payment:
When the success page shows the actual paid amount, supply both
paidAmount and currency. failureReason applies only to FAILED and NOT_SUBMITTED. See the full parameter reference.
For UNKNOWN, keep the payment identifiers and check the merchant’s existing order or payment result. Do not pay again. Report the final result before the returned report_deadline. Repeating the same outcome is safe; a conflicting final outcome is refused.
Clink records the Agent’s report and returns an agent_reported_result message. This record is not independent confirmation from the merchant. Refunds for this flow are handled by the merchant.
Give the user a brief result based on what the merchant page actually shows. For example, when the page confirms the following details:
Example Store confirmed payment of USD 12.50. Merchant order number: EX-1042.If the page does not show a merchant order number, omit it. Do not invent one or substitute Clink’s
orderId.
Recovery without a duplicate purchase
confirm_result is used only for Browser Pay. UCP Checkout and direct payments obtain their results through their own tools and must not be reported through this endpoint.
Code examples
The examples below add Browser Pay to an agent built with LangChain, the OpenAI Agents SDK, or the Claude Agent SDK.browser_tools (BROWSER_MCP_SERVER in the Claude Agent SDK) stands for your browser executor: the tools the agent uses to operate the merchant page, such as reading the final total and submitting the payment. Do not write card numbers, expiry dates, or security codes to logs or persistent storage.
MCP
Connect to Clink MCP as described in How to integrate MCP.get_access_token() comes from that page, and CLINK_SYSTEM_PROMPT is the Clink system prompt with the Browser Pay module. The agent calls get_credential and confirm_result itself. When get_credential returns credential.key and credential.payload, the agent calls a local decrypt_credential tool that you provide. The tool decrypts on your server with your private key and returns the card fields to the agent:
decrypt_credential, next to the Clink MCP tools:
API
The API has no MCP tools, so give the agent two tools of your own.pay_with_clink requests the credential and fills the card in your code, so card fields never reach the model. report_payment_result reports the merchant result with the same client_reference_id.
In the example, portal_user_token is the current user’s Portal Token, and checkout holds the server-side state of this purchase: the activated instruction_id and mandate_id, one client_reference_id, and your browser executor’s fill_card(). open_credential() is the function from the MCP example above.
CHECKOUT_PROMPT is your instruction to the agent, written from steps 1–5 above with these tool names:
Optional: Decrypt encrypted credentials
Use this section whenget_credential returns credential.key and credential.payload. First contact Clink offline to configure your platform’s public key, as described in Register an RSA public key, then decrypt with the matching private key.
If the response already contains credential.card, continue directly with Browser Pay. No decryption is needed.
Decrypt the credential
Copy the function from the expandable example below. Pass your private key and the unchangedkey and payload values from the same response. The returned body contains payment information and identifiers for result reporting.
Complete Python decryption example
Complete Python decryption example
Use Python 3.10+ and install the dependency:
private_key_pem accepts unencrypted RSA PEM private-key bytes. Adapt key loading to your existing platform implementation. The function raises an error without returning payment data if decryption fails.Read the payment information
Use the fields actually present inbody:
Also keep the outer
operation_id from the get_credential response for confirm_result.operationId.
The decrypted
amount uses major units, such as USD 12.50. get_credential.amount and confirm_result.paidAmount use minor units, which would be 1250. Convert the actual paid amount using the currency’s precision; do not copy the decrypted amount directly.Fill the card fields
When the decryptedbody contains signedPayload, use the helper below to read its card fields. Copy the function from the expandable example, then call it:
Card field-reading example
Card field-reading example
Uses the imports from the decryption example above. This function only reads fields from
signedPayload; it does not verify the JWT signature.
Check that the card number, security code, and expiry fields are present before submitting, and use the credential before it expires. Continue with step 4 to submit the payment and report the result.
Handle decryption failures
If decryption fails, check that the private key matches the public key configured for this platform and environment, and thatkey and payload come from the same complete response. If it still fails or payment fields are missing, stop before submitting and contact Clink to investigate.
If a credential was issued but the payment was never submitted, call confirm_result with the available order and operation identifiers and report NOT_SUBMITTED. Use OTHER if supplying a failureReason. If identifiers are unavailable or you need another credential, follow Browser Pay recovery.