Skip to main content
Glama

apply_discount

Idempotent

Apply a discount or promo code to the cart.

SKYFIRE TOKEN (optional): Pass a kya or kya-pay token in the skyfire-pay-id header to boost trust score. No token required — request proceeds normally if omitted. Checkout guide: https://trusteed.xyz/.well-known/agent-checkout-guide.json. CREDENTIAL: this store needs one. Call the create_sandbox_key tool first (it is in this tool list and needs no credential), then pass the key you get back as the agent_key argument — or as an Authorization: Bearer header if your client can set headers. Do not ask a person to log in: there is no human login for this store.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceNoSet to 'ucp_identity' to apply a loyalty discount derived from a UCP identity token instead of a promo code.
cart_idYesCart session ID
agent_keyNoSandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header.
discount_codeNoDiscount or promo code to apply (required unless source is ucp_identity)
identity_tokenNoUCP identity bearer token (required when source is ucp_identity).
idempotency_keyNoIdempotency key for this call (UUID-v4 or bounded ASCII token, 1-128 chars). Equivalent to the `Idempotency-Key` header — send it here if your client cannot set headers.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
cart_idYes
currencyYes
discount_codeYes
discount_centsYes
new_total_centsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / additionalProperties
      Previous value: -trueNew value: +false
    • addedInput schema / properties / idempotency_key
      Added value: +{
      +  "description": "Idempotency key for this call (UUID-v4 or bounded ASCII token, 1-128 chars). Equivalent to the `Idempotency-Key` header — send it here if your client cannot set headers.",
      +  "type": "string"
      +}
  2. Changed1 schema field changed
    • removedInput schema / properties / payment_mandate
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": {},
      -      "type": "object"
      -    },
      -    {
      -      "type": "string"
      -    }
      -  ],
      -  "description": "Payment mandate with `mandate_id`, `max_amount_cents` (integer, minor units), `currency` (3 letters, must match the cart's), `exp` (expiry as an INTEGER of Unix seconds — not an ISO 8601 date string), `sub` (your agent id) and `aud` (the store slug this mandate is for, e.g. the slug in the URL you are calling — not a domain). Use this when your client cannot set an `X-Payment-Mandate` header."
      -}
  3. Changed1 schema field changed
    • changedInput schema / properties / payment_mandate / description
      Previous value: -"Payment mandate with `mandate_id`, `max_amount_cents`, `currency`, `exp`, `sub`, `aud`. Its `currency` must match the cart's. Use this when your client cannot set an `X-Payment-Mandate` header."New value: +"Payment mandate with `mandate_id`, `max_amount_cents` (integer, minor units), `currency` (3 letters, must match the cart's), `exp` (expiry as an INTEGER of Unix seconds — not an ISO 8601 date string), `sub` (your agent id) and `aud` (the store slug this mandate is for, e.g. the slug in the URL you are calling — not a domain). Use this when your client cannot set an `X-Payment-Mandate` header."
  4. Changed2 schema fields changed
    • addedInput schema / properties / agent_key
      Added value: +{
      +  "description": "Sandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header.",
      +  "type": "string"
      +}
    • addedInput schema / properties / payment_mandate
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": {},
      +      "type": "object"
      +    },
      +    {
      +      "type": "string"
      +    }
      +  ],
      +  "description": "Payment mandate with `mandate_id`, `max_amount_cents`, `currency`, `exp`, `sub`, `aud`. Its `currency` must match the cart's. Use this when your client cannot set an `X-Payment-Mandate` header."
      +}
  5. Changed2 schema fields changed
    • changedInput schema / additionalProperties
      Previous value: -falseNew value: +true
    • changedOutput schema / additionalProperties
      Previous value: -falseNew value: +true
  6. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "cart_id": {
      +      "type": "string"
      +    },
      +    "currency": {
      +      "type": "string"
      +    },
      +    "discount_cents": {
      +      "type": "number"
      +    },
      +    "discount_code": {
      +      "type": "string"
      +    },
      +    "new_total_cents": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "cart_id",
      +    "discount_code",
      +    "discount_cents",
      +    "new_total_cents",
      +    "currency"
      +  ],
      +  "type": "object"
      +}
  7. Changed4 schema fields changed
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties
      Added value: +{
      +  "cart_id": {
      +    "description": "Cart session ID",
      +    "type": "string"
      +  },
      +  "discount_code": {
      +    "description": "Discount or promo code to apply (required unless source is ucp_identity)",
      +    "maxLength": 50,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "identity_token": {
      +    "description": "UCP identity bearer token (required when source is ucp_identity).",
      +    "maxLength": 4096,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "source": {
      +    "const": "ucp_identity",
      +    "description": "Set to 'ucp_identity' to apply a loyalty discount derived from a UCP identity token instead of a promo code.",
      +    "type": "string"
      +  }
      +}
    • addedInput schema / required
      Added value: +[
      +  "cart_id"
      +]
  8. Changed5 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties
      Removed value: -{
      -  "cart_id": {
      -    "description": "Cart session ID",
      -    "type": "string"
      -  },
      -  "discount_code": {
      -    "description": "Discount or promo code to apply",
      -    "maxLength": 50,
      -    "minLength": 1,
      -    "type": "string"
      -  }
      -}
    • removedInput schema / required
      Removed value: -[
      -  "cart_id",
      -  "discount_code"
      -]
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "http://json-schema.org/draft-07/schema#",
      -  "additionalProperties": false,
      -  "properties": {
      -    "cart_id": {
      -      "type": "string"
      -    },
      -    "currency": {
      -      "type": "string"
      -    },
      -    "discount_cents": {
      -      "type": "number"
      -    },
      -    "discount_code": {
      -      "type": "string"
      -    },
      -    "new_total_cents": {
      -      "type": "number"
      -    }
      -  },
      -  "required": [
      -    "cart_id",
      -    "discount_code",
      -    "discount_cents",
      -    "new_total_cents",
      -    "currency"
      -  ],
      -  "type": "object"
      -}New value: +null
  9. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources