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
| 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 | 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. |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cart_id | Yes | ||
| currency | Yes | ||
| discount_code | Yes | ||
| discount_cents | Yes | ||
| new_total_cents | Yes |