> ## Documentation Index
> Fetch the complete documentation index at: https://docs.y.uno/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 订阅促销对象

> 介绍订阅上的促销对象：折扣、已使用的周期、暂停行为以及促销的结束方式

将促销应用到订阅时，Yuno 会在订阅上存储该促销的副本。该副本就是 `promotion` 对象。[创建订阅](https://docs.y.uno/zh-hans/reference/subscriptions/create-subscription.md) 和 [更新订阅](https://docs.y.uno/zh-hans/reference/subscriptions/update-subscription.md) 会返回该对象。副本从不会被编辑：之后更改计划上的附加关系或促销本身都不会改变它。请参阅 [订阅计划促销](https://docs.y.uno/zh-hans/docs/payment-features/subscriptions/promotions.md)。

## 属性

**id** `string`

促销的 ID（UUID）。

示例：8f2d6c1e-3b7a-4c55-9a1e-2f4d8b7c6a10

**name** `string`

促销的名称。

示例：Welcome 20% x3

**discount** `object`

折扣。字段取决于 `type`。

**属性**

**type** `enum`

`PERCENTAGE` 或 `FIXED`。

**value** `number`

仅适用于 `PERCENTAGE`。百分比，取值范围为 0 到 100，最多 2 位小数。

示例：20

**amount** `number`

仅适用于 `FIXED`。金额，使用该币种的小数位数。

示例：15.00

**currency** `string`

仅适用于 `FIXED`。`amount` 的 ISO 4217 币种。

示例：USD

**cycles** `object`

折扣覆盖的收费次数。

**属性**

**total** `integer`

促销覆盖的周期数，在促销附加到计划时设置。

**used** `integer`

自应用以来计入的周期：已批准的收费、试用周期以及 100% 折扣的周期。已拒绝的收费不计入。同一笔收费的重试只计一次。

**remaining** `integer`

`total` 减去 `used`。

**on\_pause** `enum`

暂停对促销的影响：`KEEP`（恢复时继续使用剩余周期）或 `END`（促销以原因 `PAUSE` 结束）。应用促销时，该值从计划上的附加关系复制而来。

**status** `enum`

`ACTIVE`：仍有剩余周期。`COMPLETED`：所有周期均已使用。`ENDED`：促销提前结束。

**applied\_at** `timestamp`

应用促销的时间（ISO 8601）。

示例：2026-11-02T14:00:00Z

**ended\_at** `timestamp`

促销结束的时间。促销生效期间为 `null`。

**end\_reason** `enum`

促销生效期间为 `null`。否则为以下值之一：`REPLACED`（应用了另一个促销）、`REMOVED`（已从订阅中移除）、`PLAN_CHANGE`（计划已变更，促销随之结束）、`PAUSE`（订阅已暂停且 `on_pause` 为 `END`），或 `CANCELED`（订阅已取消）。

## 示例

一个使用百分比促销、已使用 3 个周期中 2 个的订阅：

```json Promotion object theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "id": "8f2d6c1e-3b7a-4c55-9a1e-2f4d8b7c6a10",
  "name": "Welcome 20% x3",
  "discount": { "type": "PERCENTAGE", "value": 20 },
  "cycles": { "total": 3, "used": 2, "remaining": 1 },
  "on_pause": "KEEP",
  "status": "ACTIVE",
  "applied_at": "2026-11-02T14:00:00Z",
  "ended_at": null,
  "end_reason": null
}
```

固定金额促销：

```json Fixed discount theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "discount": { "type": "FIXED", "amount": 15.00, "currency": "USD" }
}
```

## 在 webhooks 中

[`subscription.cycle_executed`](https://docs.y.uno/zh-hans/docs/webhooks/object-and-examples#subscription-cycle_executed) 会在每个享受折扣的周期中携带一个简化的 `promotion` 对象，包含 `id`、`discount_amount` 和 `cycles_remaining`。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.