apply_discount
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. PAYMENT MANDATE: this tool also requires one. Send it as the payment_mandate argument if your client cannot set headers, or as an X-Payment-Mandate header. It must carry mandate_id, max_amount_cents, currency, exp, sub, aud, and its currency must match the cart's currency or the call is denied outright. The cap in max_amount_cents is enforced against the cart total. 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). | |
| payment_mandate | No | 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cart_id | Yes | ||
| currency | Yes | ||
| discount_code | Yes | ||
| discount_cents | Yes | ||
| new_total_cents | Yes |