Skip to main content
Glama

Prepare payment

checkout_prepare_payment
Idempotent

Quote the selected cart lines and prepare a short-lived confirmation in one call when the shipping option is unambiguous. The confirmation is bound to the exact selected lines, cart revision, address, selected shipping option, and currency. Server checks the supplied cartRevision and selectedLines against the live cart. If shippingOptionId is omitted and exactly one option is available, it prepares that option; if several are available, it returns the quote and options without preparing payment. After the user selects an option, call this tool again with the same address and selectedLines, the selected shippingOptionId, and the latest cartRevision returned in quote.cartRevision. Review the exact total and shipping option with the user before calling checkout_create_payment_link. This tool creates no order or charge. At payment-link creation, the confirmation is bound to one idempotencyKey: retries must use that same key, and another key is rejected. If the cart changes, payment creation is blocked and checkout must be prepared again.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "countryCode": "<countryCode>",
      "currencyCode": "<currencyCode>",
      "languageCode": "<languageCode>",
      "addressId": "<addressId>",
      "cartRevision": "<cartRevision>",
      "selectedLines": "<selectedLines>"
    },
    "name": "checkout_prepare_payment"
  }
}

Input Schema

NameRequiredDescriptionDefault
addressIdYesUUID of the selected shipping address.
promoCodeNoOptional promotional or coupon code. Validity confirmed at quote time.
useCreditsNoApply available account credits toward the total.
countryCodeYesISO 3166-1 alpha-2 market country code. Choose from market_list output.
cartRevisionYesThe global cart revision returned by cart_get.
currencyCodeYesISO 4217 alpha-3 market currency code. Choose from market_list output.
languageCodeYesLowercase ISO 639-1 language code. Choose from market_list output.
selectedLinesYesThe exact cart lines to check out. Copy itemId, configurationId when present, and wholesale from cart_get. Unlisted cart lines stay in the cart.
shippingOptionIdNoOptional shipping option ID. When omitted, the only available option is selected automatically; with multiple options, the tool returns choices and prepares nothing. On that response, use quote.cartRevision when calling again with the selected option.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / shippingOptionId / description
      Previous value: -"Selected shipping option ID from checkout_quote response. Must match shippingOptions[].id exactly."New value: +"Optional shipping option ID. When omitted, the only available option is selected automatically; with multiple options, the tool returns choices and prepares nothing. On that response, use quote.cartRevision when calling again with the selected option."
    • changedInput schema / required
      Previous value: -[
      -  "countryCode",
      -  "currencyCode",
      -  "languageCode",
      -  "addressId",
      -  "cartRevision",
      -  "selectedLines",
      -  "shippingOptionId"
      -]New value: +[
      +  "countryCode",
      +  "currencyCode",
      +  "languageCode",
      +  "addressId",
      +  "cartRevision",
      +  "selectedLines"
      +]
  2. Changed3 schema fields changed
    • addedInput schema / properties / cartRevision
      Added value: +{
      +  "description": "The global cart revision returned by cart_get.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / selectedLines
      Added value: +{
      +  "description": "The exact cart lines to check out. Copy itemId, configurationId when present, and wholesale from cart_get. Unlisted cart lines stay in the cart.",
      +  "items": {
      +    "properties": {
      +      "configurationId": {
      +        "pattern": "^[A-Za-z0-9._:-]{1,128}$",
      +        "type": "string"
      +      },
      +      "itemId": {
      +        "description": "An itemId copied from one selected line in cart_get.",
      +        "pattern": "^[A-Za-z0-9._:-]{1,128}$",
      +        "type": "string"
      +      },
      +      "wholesale": {
      +        "description": "The exact wholesale value copied from that cart_get line.",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "itemId",
      +      "wholesale"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 50,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "countryCode",
      -  "currencyCode",
      -  "languageCode",
      -  "addressId",
      -  "shippingOptionId"
      -]New value: +[
      +  "countryCode",
      +  "currencyCode",
      +  "languageCode",
      +  "addressId",
      +  "cartRevision",
      +  "selectedLines",
      +  "shippingOptionId"
      +]
  3. Changed7 schema fields changed
    • addedInput schema / properties / addressId / description
      Added value: +"UUID of the selected shipping address."
    • addedInput schema / properties / countryCode / description
      Added value: +"ISO 3166-1 alpha-2 market country code. Choose from market_list output."
    • addedInput schema / properties / currencyCode / description
      Added value: +"ISO 4217 alpha-3 market currency code. Choose from market_list output."
    • addedInput schema / properties / languageCode / description
      Added value: +"Lowercase ISO 639-1 language code. Choose from market_list output."
    • addedInput schema / properties / promoCode / description
      Added value: +"Optional promotional or coupon code. Validity confirmed at quote time."
    • addedInput schema / properties / shippingOptionId / description
      Added value: +"Selected shipping option ID from checkout_quote response. Must match shippingOptions[].id exactly."
    • addedInput schema / properties / useCredits / description
      Added value: +"Apply available account credits toward the total."
  4. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark it non-read-only, idempotent, non-destructive, but the description adds the mechanics that matter: server-side validation of cartRevision and selectedLines against the live cart, a short-lived confirmation bound to specific fields, no order or charge created, blocking if the cart changes, and the idempotencyKey binding at payment-link creation (retries must reuse the key, other keys rejected). That is meaningful behavior beyond the annotation set.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then layered rules; nearly every sentence carries a constraint. Minor redundancy: the shippingOptionId branch logic overlaps almost verbatim with the schema's own description of that parameter, and the cartRevision round-trip is stated twice.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 9-parameter, two-phase flow with no output schema, it covers the important state machine (prepare → return options → prepare again → create payment link) and names the response field quote.cartRevision. It could say more about what the quote response contains (total shape, option list) or what happens on stale revisions, but it is close to sufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description goes further by explaining the conditional semantics of the optional shippingOptionId (auto-select vs. return choices) and by prescribing the exact round-trip for cartRevision and selectedLines. It does not add much about promoCode, useCredits, or addressId beyond what the schema states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific compound verb ('quote ... and prepare a short-lived confirmation') on a specific resource (the selected cart lines), and immediately clarifies what it is not ('creates no order or charge'), which separates it from checkout_create_payment_link and checkout_quote. An agent can identify the tool's role without reading the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing rules are given: call it when the shipping option is unambiguous; when shippingOptionId is omitted and multiple options exist, it returns a quote and prepares nothing, after which you call it again with the chosen option and the new quote.cartRevision. It also names the downstream step and the precondition ('Review the exact total and shipping option with the user before calling checkout_create_payment_link').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources