apply_discount
Apply a discount or promo code to the cart. Checkout guide: read the MCP resource trusteed://guides/checkout. 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
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | Set to 'ucp_identity' to apply a loyalty discount derived from a UCP identity token instead of a promo code. | |
| cart_id | Yes | Cart session ID | |
| agent_key | No | Sandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header. | |
| discount_code | No | Discount or promo code to apply (required unless source is ucp_identity) | |
| identity_token | No | UCP identity bearer token (required when source is ucp_identity). | |
| idempotency_key | No | REQUIRED for this write unless sent as the `Idempotency-Key` header or `params._meta["trusteed/idempotency-key"]`. 1-128 chars from [A-Za-z0-9._:/-]. Reuse the same value when retrying the same operation. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cart_id | Yes | ||
| currency | Yes | ||
| discount_code | Yes | ||
| discount_cents | Yes | ||
| new_total_cents | Yes |