# 查询退款操作结果

Operation / SDK: `readRefund` · `read_refund` · `ReadRefund`

读取退款操作的结果。

更新于 2026-11-06

[网页版本](https://www.longplayai.com/zh-hans/docs/api/read-refund)

<a id="request"></a>

## 请求

- **凭据**: Server Key，权限 `billing:read`。只在后端调用。
- **SDK**: JavaScript `createLongplayServer().readRefund` · Python `read_refund` · Go `ReadRefund`
- **成功状态**: HTTP 200

> 在 `record_only` 模式下，商户须先支持商户桥接 v4 的 `operation.prepare` 准备命令，Longplay 才能冻结报价并生成 `merchantTerms`；确认报价时提交与之匹配的 `merchantConfirmation`。

- [商户准备报价](https://www.longplayai.com/zh-hans/docs/guides/merchant-execution.md#prepared-terms)

响应为示例数据。

**cURL: request.sh**

```bash
curl -X POST "$LONGPLAY_API_URL/api/v1/subscriptions/refunds/read" \
  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \
  -H "X-Indiana-Protocol: 0.10" \
  -H "Content-Type: application/json" \
  -d '{
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d",
  "operationId": "a8b14e0c-6576-49a4-812c-7a1587e55255"
}'
```

**TypeScript: readRefund.ts**

```ts
import { createLongplayServer } from "@tinkerlandai/longplay-sdk/server";

const longplay = createLongplayServer({
  baseUrl: process.env.LONGPLAY_API_URL!,
  apiKey: process.env.LONGPLAY_SERVER_KEY!,
  scope: { projectId: process.env.LONGPLAY_PROJECT_ID!, environment: "sandbox" },
});

export async function readRefund() {
  return longplay.readRefund({
    customerId: "8b258f8b-4228-40fa-8d24-5b16428e686d",
    operationId: "a8b14e0c-6576-49a4-812c-7a1587e55255",
  });
}
```

**请求体: request.json**

```json
{
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d",
  "operationId": "a8b14e0c-6576-49a4-812c-7a1587e55255"
}
```

**响应示例: response.json**

```json
{
  "requestId": "44f5fcb8-6ed8-41b8-818f-7571941c5fd5",
  "scope": {
    "projectId": "df5426d6-b335-403c-8f3e-b0f73d2e3511",
    "environment": "sandbox"
  },
  "operation": {
    "operationId": "a8b14e0c-6576-49a4-812c-7a1587e55255",
    "invoiceId": "01d9f76a-62d9-4688-8804-b4734805f049",
    "providerInvoiceId": "1Example",
    "status": "quoted",
    "executor": "indiana",
    "currency": "USD",
    "amountMinor": 1,
    "mode": "full",
    "entitlementAction": "retain",
    "refundId": null,
    "execution": null,
    "failureReason": null,
    "createdAt": "2026-10-03T12:00:00.000Z",
    "completedAt": null
  }
}
```

<a id="parameters"></a>

## 请求体参数

**application/json**

- `operationId` (uuid, required): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `customerId` (uuid, required): Customer 的 UUID。

<a id="response"></a>

## 响应字段

成功响应都包含 `requestId`（本次请求 ID，排查时提供）和 `scope`（App 与环境）。

**HTTP 200 · application/json**

- `requestId` (uuid, required): 服务端为这次 HTTP 请求生成的 UUID，排查时提供；它不是你的业务 requestId。
- `scope` (object, required): 响应实际所属的 App 和环境。Header 只能核对，不能切换 Key 范围。
- `scope.projectId` (string, required): 凭据绑定的 App ID。 minLength: 1
- `scope.environment` (enum, required): 独立数据范围：sandbox 或 live。 Values: `"sandbox"`, `"live"`.
- `operation` (object, required): 操作对象：状态、结果与恢复信息。
- `operation.operationId` (uuid, required): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.invoiceId` (uuid, required): 发票的 ID。
- `operation.providerInvoiceId` (string, required): 支付渠道中的发票的 ID。 minLength: 1 · maxLength: 200
- `operation.status` (enum, required): 状态，取值见允许值。 Values: `"quoted"`, `"pending"`, `"succeeded"`, `"failed"`, `"expired"`.
- `operation.executor` (enum, required): 执行方，取值见允许值。 Values: `"indiana"`, `"merchant"`.
- `operation.currency` (enum, required): 已发布价格支持的币种代码。 Values: `"USD"`, `"EUR"`, `"CNY"`, `"GBP"`, `"JPY"`, `"CAD"`, `"AUD"`, `"NZD"`, `"CHF"`, `"HKD"`, `"SGD"`, `"KRW"`, `"INR"`, `"BRL"`, `"MXN"`, `"TWD"`, `"THB"`, `"IDR"`, `"MYR"`, `"PHP"`, `"VND"`, `"ZAR"`, `"AED"`, `"SAR"`, `"SEK"`, `"NOK"`, `"DKK"`, `"PLN"`, `"CZK"`, `"HUF"`, `"ILS"`, `"TRY"`, `"RON"`.
- `operation.amountMinor` (integer, required): 金额，以最小货币单位计（如美分）。 max: 200000000
- `operation.mode` (enum, required): 模式，取值见允许值。 Values: `"full"`, `"partial"`.
- `operation.entitlementAction` (enum, required): 退款后保留（`retain`）或撤销（`revoke`）权益。 Values: `"retain"`, `"revoke"`.
- `operation.refundId` (string | null, required): Stripe 中退款创建后的退款 ID（`re_...` 或 `pyr_...`），此前为 `null`。`status` 为 `succeeded` 时一定有值。
- `operation.quote` (object, optional): 报价。
- `operation.quote.operationId` (uuid, required): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.quote.merchantTerms` (object, optional): 商户已准备好的条款；有它时金额和周期以它为准。
- `operation.quote.merchantTerms.request` (object | object | object, required): 商户收到的原准备请求，用来证明这些条款属于哪次选择。
- `operation.quote.merchantTerms.requestDigest` (string, required): 原准备请求的规范摘要。 pattern: ^[a-f0-9]{64}$
- `operation.quote.merchantTerms.merchantQuoteId` (string, required): 商户这次报价的引用。 minLength: 1 · maxLength: 200
- `operation.quote.merchantTerms.quoteTermsDigest` (string, required): 条款规范摘要；确认时绑定它，之后不可更换。 pattern: ^[a-f0-9]{64}$
- `operation.quote.merchantTerms.termsVersion` (string, required): 商户条款版本。 minLength: 1 · maxLength: 200
- `operation.quote.merchantTerms.sourceRevisions` (array, required): 报价依据的商品目录或订阅版本。 maxItems: 100
- `operation.quote.merchantTerms.observedAt` (date-time, required): 时间（ISO 8601）。
- `operation.quote.merchantTerms.expiresAt` (date-time, required): 到期时间（ISO 8601，UTC）。
- `operation.quote.merchantTerms.currency` (string, required): 已发布价格支持的币种代码。 pattern: ^[A-Z]{3}$
- `operation.quote.merchantTerms.automaticTax` (boolean, required): 税额是否由商户按自动税计算；未知税额不会当作 0。
- `operation.quote.merchantTerms.lines` (array, required): 明细行。 maxItems: 100
- `operation.quote.merchantTerms.subscriptionTerms` (object | null, required): 后续周期的订阅承诺，独立于本次扣款；非订阅时为空。
- `operation.quote.merchantTerms.subtotalMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: -200000000 · max: 200000000
- `operation.quote.merchantTerms.discountMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.quote.merchantTerms.nativeDiscountMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.quote.merchantTerms.discount` (object | null, optional): 折扣。
- `operation.quote.merchantTerms.taxMinor` (integer | null, required): 金额，以最小货币单位计（如美分）。
- `operation.quote.merchantTerms.totalMinor` (integer | null, required): 金额，以最小货币单位计（如美分）。
- `operation.quote.merchantTerms.effectiveAt` (date-time | null, required): 时间（ISO 8601）。
- `operation.quote.merchantTerms.expectedEffects` (array, required): 商户承诺的原生结果，用于确认展示，不代表平台余额。 maxItems: 100
- `operation.quote.merchantTerms.requiredConsents` (array, required): 确认前用户必须接受的商户条款。 maxItems: 20
- `operation.quote.invoiceId` (uuid, required): 发票的 ID。
- `operation.quote.providerInvoiceId` (string, required): 支付渠道中的发票的 ID。 minLength: 1 · maxLength: 200
- `operation.quote.currency` (enum, required): 已发布价格支持的币种代码。 Values: `"USD"`, `"EUR"`, `"CNY"`, `"GBP"`, `"JPY"`, `"CAD"`, `"AUD"`, `"NZD"`, `"CHF"`, `"HKD"`, `"SGD"`, `"KRW"`, `"INR"`, `"BRL"`, `"MXN"`, `"TWD"`, `"THB"`, `"IDR"`, `"MYR"`, `"PHP"`, `"VND"`, `"ZAR"`, `"AED"`, `"SAR"`, `"SEK"`, `"NOK"`, `"DKK"`, `"PLN"`, `"CZK"`, `"HUF"`, `"ILS"`, `"TRY"`, `"RON"`.
- `operation.quote.paidMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.quote.refundedMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.quote.pendingMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.quote.amountMinor` (integer, required): 金额，以最小货币单位计（如美分）。 max: 200000000
- `operation.quote.mode` (enum, required): 模式，取值见允许值。 Values: `"full"`, `"partial"`.
- `operation.quote.entitlementAction` (enum, required): 退款后保留（`retain`）或撤销（`revoke`）权益。 Values: `"retain"`, `"revoke"`.
- `operation.quote.revokes` (object, required): `entitlementAction: "revoke"` 将结束的内容：本发票所支付的 Customer 的 Product，以及随退款立即取消的 Stripe 订阅。`entitlementAction` 为 `retain` 时两个列表均为空。
- `operation.quote.revokes.customerProductIds` (array, required): 本次退款将结束的、由本发票支付的 Customer 的 Product 的 ID（与 `membershipId` 相同）：一次性 Product 立即结束，订阅型 Product 在其 Stripe 订阅取消时结束。 maxItems: 100
- `operation.quote.revokes.subscriptionIds` (array, required): 订阅的 ID 列表。 maxItems: 20
- `operation.quote.execution` (object | object, required): 执行信息。
- `operation.quote.execution.provider` ("stripe" | "merchant", required): 支付渠道，取值见允许值。
- `operation.quote.execution.executor` (enum | "merchant", required): 执行方，取值见允许值。
- `operation.quote.execution.accountId` (string, optional): Stripe 账户 ID（`acct_…`）。 pattern: ^acct_[A-Za-z0-9]+$
- `operation.quote.execution.invoice` (string, optional): Stripe 发票 ID（`in_…`）。 pattern: ^in_[A-Za-z0-9]+$
- `operation.quote.execution.amountMinor` (integer | integer, required): 金额，以最小货币单位计（如美分）。
- `operation.quote.execution.currency` (string | string, required): 已发布价格支持的币种代码。
- `operation.quote.execution.metadata` (object, optional): 自定义键值数据。
- `operation.quote.execution.idempotencyKey` (string, optional): 稳定的业务幂等 Key。同一 Key 和同一参数返回同一结果；不要每次重试随机生成。 pattern: ^indiana-refund-[0-9a-f-]{36}$
- `operation.quote.execution.cancelSubscriptions` (array | array, required): 要取消的订阅。
- `operation.quote.execution.operationId` (uuid, optional): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.quote.execution.customerId` (uuid, optional): Customer 的 UUID。
- `operation.quote.execution.configurationRevision` (integer, optional): 扫描配置的修订号。 min: 0 · max: 9007199254740991
- `operation.quote.execution.connectionRevision` (integer, optional): 冻结此商业指令时的商户连接修订号；用于核对此操作仍使用同一连接配置。 min: 0 · max: 9007199254740991
- `operation.quote.execution.expiresAt` (date-time, optional): 到期时间（ISO 8601，UTC）。
- `operation.quote.execution.type` ("refund", optional): 原商户商业指令的类型：购买、订阅变更或退款。按该类型读取对应的固定商业参数。
- `operation.quote.execution.invoiceId` (uuid, optional): 发票的 ID。
- `operation.quote.execution.merchantInvoiceId` (string, optional): 本次退款对应的商户原生发票稳定引用。 minLength: 1 · maxLength: 200
- `operation.quote.execution.mode` (enum, optional): 模式，取值见允许值。 Values: `"full"`, `"partial"`.
- `operation.quote.execution.entitlementAction` (enum, optional): 退款后保留（`retain`）或撤销（`revoke`）权益。 Values: `"retain"`, `"revoke"`.
- `operation.quote.expiresAt` (date-time, required): 到期时间（ISO 8601，UTC）。
- `operation.execution` (object | object | null, required): 执行信息。
- `operation.execution.provider` ("stripe" | "merchant", required): 支付渠道，取值见允许值。
- `operation.execution.executor` (enum | "merchant", required): 执行方，取值见允许值。
- `operation.execution.accountId` (string, optional): Stripe 账户 ID（`acct_…`）。 pattern: ^acct_[A-Za-z0-9]+$
- `operation.execution.invoice` (string, optional): Stripe 发票 ID（`in_…`）。 pattern: ^in_[A-Za-z0-9]+$
- `operation.execution.amountMinor` (integer | integer, required): 金额，以最小货币单位计（如美分）。
- `operation.execution.currency` (string | string, required): 已发布价格支持的币种代码。
- `operation.execution.metadata` (object, optional): 自定义键值数据。
- `operation.execution.metadata.indianaRefundId` (uuid, required): 退款操作 ID（与 `operationId` 相同）。Stripe 退款必须在 metadata 中原样携带该值，才能与本操作对应。
- `operation.execution.idempotencyKey` (string, optional): 稳定的业务幂等 Key。同一 Key 和同一参数返回同一结果；不要每次重试随机生成。 pattern: ^indiana-refund-[0-9a-f-]{36}$
- `operation.execution.cancelSubscriptions` (array | array, required): 要取消的订阅。
- `operation.execution.operationId` (uuid, optional): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.execution.customerId` (uuid, optional): Customer 的 UUID。
- `operation.execution.configurationRevision` (integer, optional): 扫描配置的修订号。 min: 0 · max: 9007199254740991
- `operation.execution.connectionRevision` (integer, optional): 冻结此商业指令时的商户连接修订号；用于核对此操作仍使用同一连接配置。 min: 0 · max: 9007199254740991
- `operation.execution.expiresAt` (date-time, optional): 到期时间（ISO 8601，UTC）。
- `operation.execution.type` ("refund", optional): 原商户商业指令的类型：购买、订阅变更或退款。按该类型读取对应的固定商业参数。
- `operation.execution.invoiceId` (uuid, optional): 发票的 ID。
- `operation.execution.merchantInvoiceId` (string, optional): 本次退款对应的商户原生发票稳定引用。 minLength: 1 · maxLength: 200
- `operation.execution.mode` (enum, optional): 模式，取值见允许值。 Values: `"full"`, `"partial"`.
- `operation.execution.entitlementAction` (enum, optional): 退款后保留（`retain`）或撤销（`revoke`）权益。 Values: `"retain"`, `"revoke"`.
- `operation.confirmedAt` (date-time | null, optional): 时间（ISO 8601）。
- `operation.merchantExecution` (object | object | object | null, optional): 商户原操作的执行快照，分别保留付款、履约及回报 Longplay 的状态。
- `operation.merchantExecution.operationId` (uuid | uuid | uuid, required): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.merchantExecution.customerId` (uuid | uuid | uuid, required): Customer 的 UUID。
- `operation.merchantExecution.merchantExecutionId` (string | string | string, required): 商户为原操作保存的稳定执行引用；读取和恢复时保留同一引用。
- `operation.merchantExecution.fulfillmentStatus` (enum | enum | enum, required): 商户原生履约的进度或结果，包括尚未开始、进行中、已应用、失败或不适用。
- `operation.merchantExecution.recordingStatus` (enum | enum | enum, required): 执行结果回报 Longplay 的进度；付款和原生履约是否完成仍由各自状态表示。
- `operation.merchantExecution.updatedAt` (date-time | date-time | date-time, required): 记录最后更新时的 ISO 8601 UTC 时间。
- `operation.merchantExecution.problem` (object | null | object | null | object | null, required): 此执行快照中记录的问题，包含发生阶段、错误码及原操作的恢复建议；无问题时为 `null`。
- `operation.merchantExecution.problem.phase` (enum | enum | enum, required): 问题发生的阶段：执行、付款、履约或回报 Longplay。
- `operation.merchantExecution.problem.code` (enum | enum | enum, required): 此问题的结构化 API 错误码，配合阶段及恢复建议处理原操作。
- `operation.merchantExecution.problem.reason` (enum | enum | enum, optional): 此错误的细分原因；`RESULT_UNKNOWN` 表示财务结果未确认，须恢复原操作。
- `operation.merchantExecution.problem.recovery` (enum | enum | enum, required): 原操作的下一步恢复动作；财务结果未确认时按 `recover_operation` 恢复原操作。
- `operation.merchantExecution.problem.retryable` (boolean | boolean | boolean, required): 是否可按给定恢复动作重试失败请求；`RESULT_UNKNOWN` 时为 `false`，保留原操作进行恢复。
- `operation.merchantExecution.pollAfterMs` (integer | null | integer | null | integer | null, required): 再次读取同一原操作前建议等待的毫秒数；未提供轮询间隔时为 `null`。
- `operation.merchantExecution.type` ("purchase" | "subscription_change" | "refund", required): 此执行快照所属的原操作类型：购买、订阅变更或退款。
- `operation.merchantExecution.merchantOrderId` (string | null, optional): 原购买的商户订单稳定引用；尚未获得订单引用时为 `null`。
- `operation.merchantExecution.paymentStatus` (enum, optional): 原购买的付款进度或已观察到的结果；履约及回报 Longplay 的进度分别查看对应状态。 Values: `"not_started"`, `"pending"`, `"succeeded"`, `"not_required"`, `"failed"`, `"expired"`, `"unknown"`.
- `operation.merchantExecution.checkoutUrl` (uri | null, optional): 付款页面链接；为空时无需跳转。
- `operation.merchantExecution.checkoutExpiresAt` (date-time | null, optional): 时间（ISO 8601）。
- `operation.merchantExecution.status` (enum | enum, optional): 状态，取值见允许值。
- `operation.merchantExecution.merchantSubscriptionId` (string, optional): 此变更快照对应的商户原生订阅稳定引用。 minLength: 1 · maxLength: 200
- `operation.merchantExecution.scheduledFor` (date-time | null, optional): 已安排的原订阅变更生效时间（ISO 8601）；非 scheduled 状态时为 `null`。
- `operation.merchantExecution.nextAction` (object, optional): 原订阅变更的可选后续付款动作，包含商户提供的 HTTPS 支付页面及过期时间；读取或恢复时仍对应同一原操作。
- `operation.merchantExecution.nextAction.type` ("redirect", required): 后续付款动作类型，固定为 `redirect`：跳转到商户提供的原付款页面。
- `operation.merchantExecution.nextAction.url` (string, required): 商户提供的原付款页面地址（HTTPS），用于完成原操作所需的付款或验证；结果以读取同一原操作为准。 pattern: ^https:\/\/.*
- `operation.merchantExecution.nextAction.expiresAt` (date-time, required): 到期时间（ISO 8601，UTC）。
- `operation.merchantExecution.merchantRefundId` (string | null, optional): 原退款的商户稳定引用；尚未获得时为 `null`，成功退款必须保留此引用。
- `operation.problem` (object | null, optional): 阻碍原商户操作继续推进的结构化问题，包含阶段、错误码及恢复建议；无问题时为 `null`。
- `operation.problem.phase` (enum, required): 问题发生的阶段：执行、付款、履约或回报 Longplay。 Values: `"execution"`, `"payment"`, `"fulfillment"`, `"recording"`.
- `operation.problem.code` (enum, required): 此问题的结构化 API 错误码，配合阶段及恢复建议处理原操作。 Values: `"INVALID_PROTOCOL_VERSION"`, `"UNSUPPORTED_PROTOCOL_VERSION"`, `"PROTOCOL_RETIRED"`, `"UNAUTHENTICATED"`, `"FORBIDDEN"`, `"SCOPE_MISMATCH"`, `"INVALID_REQUEST"`, `"NOT_FOUND"`, `"CONFLICT"`, `"PAYLOAD_TOO_LARGE"`, `"RATE_LIMITED"`, `"SERVICE_UNAVAILABLE"`, `"NOT_CONFIGURED"`, `"CAPABILITY_UNAVAILABLE"`, `"INTERNAL_ERROR"`.
- `operation.problem.reason` (enum, optional): 此错误的细分原因；`RESULT_UNKNOWN` 表示财务结果未确认，须恢复原操作。 Values: `"CAPABILITY_NOT_ENABLED"`, `"INTEGRATION_MISSING"`, `"PROVIDER_CREDENTIAL_REJECTED"`, `"PRICE_BINDING_REQUIRED"`, `"IDEMPOTENCY_CONFLICT"`, `"RESULT_UNKNOWN"`, `"STATE_CHANGED"`, `"IDENTITY_CONTEXT_CHANGED"`, `"CUSTOMER_BINDING_CONFLICT"`, `"RUN_CONTRACT_MISMATCH"`, `"OPERATION_IN_PROGRESS"`, `"FUNNEL_VERSION_RETIRED"`, `"FUNNEL_PAUSED"`.
- `operation.problem.recovery` (enum, required): 原操作的下一步恢复动作；财务结果未确认时按 `recover_operation` 恢复原操作。 Values: `"fix_request"`, `"authenticate"`, `"check_permissions"`, `"check_scope"`, `"resolve_conflict"`, `"reload_state"`, `"retry_same_request"`, `"configure_integration"`, `"check_availability"`, `"upgrade_sdk"`, `"recover_operation"`, `"contact_support"`.
- `operation.problem.retryable` (boolean, required): 是否可按给定恢复动作重试失败请求；`RESULT_UNKNOWN` 时为 `false`，保留原操作进行恢复。
- `operation.authority` (object, optional): 原商户操作的执行授权，包含 App/环境、Customer、确认事实及固定商业指令。
- `operation.authority.scope` (object, required): 响应实际所属的 App 和环境。Header 只能核对，不能切换 Key 范围。
- `operation.authority.scope.projectId` (uuid, required): 凭据绑定的 App ID。
- `operation.authority.scope.environmentId` (uuid, required): 环境的 ID。
- `operation.authority.scope.environment` (enum, required): 独立数据范围：sandbox 或 live。 Values: `"sandbox"`, `"live"`.
- `operation.authority.operationId` (uuid, required): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.authority.customerId` (uuid, required): Customer 的 UUID。
- `operation.authority.confirmedAt` (date-time | null, required): 时间（ISO 8601）。
- `operation.authority.initialExecutionAllowed` (boolean, required): 当前授权是否允许首次派发原商业指令。为 `false` 时遵循原操作的状态与恢复要求。
- `operation.authority.instruction` (object | object | object, required): 此授权绑定的原购买、订阅变更或退款指令；保留其 operationId、Customer 与固定商业参数。
- `operation.authority.instruction.provider` ("merchant" | "merchant" | "merchant", required): 支付渠道，取值见允许值。
- `operation.authority.instruction.executor` ("merchant" | "merchant" | "merchant", required): 执行方，取值见允许值。
- `operation.authority.instruction.operationId` (uuid | uuid | uuid, required): 业务操作 UUID；订阅执行引用 previewAttach 返回的 operationId，余额退款引用原消费操作。
- `operation.authority.instruction.customerId` (uuid | uuid | uuid, required): Customer 的 UUID。
- `operation.authority.instruction.configurationRevision` (integer | integer | integer, required): 扫描配置的修订号。
- `operation.authority.instruction.connectionRevision` (integer | integer | integer, required): 原指令绑定的商户连接修订号；执行时须与该操作获准使用的连接配置一致。
- `operation.authority.instruction.currency` (string | string | string, required): 已发布价格支持的币种代码。
- `operation.authority.instruction.expiresAt` (date-time | date-time | date-time, required): 到期时间（ISO 8601，UTC）。
- `operation.authority.instruction.type` ("purchase" | "subscription_change" | "refund", required): 授权绑定的原商户指令类型：购买、订阅变更或退款。
- `operation.authority.instruction.mode` (enum | enum, optional): 模式，取值见允许值。
- `operation.authority.instruction.lineItems` (array | array, optional): 明细行。
- `operation.authority.instruction.catalogAmountMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.nativeDiscountMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.discount` (object | null | object | null, optional): 折扣。
- `operation.authority.instruction.trialPeriodDays` (integer | null, optional): 天数。
- `operation.authority.instruction.automaticTax` (boolean, optional): 此已授权购买指令固定的自动计税要求，由商户原生支付流程执行。
- `operation.authority.instruction.subscriptionId` (uuid, optional): 订阅的 ID。
- `operation.authority.instruction.merchantSubscriptionId` (string, optional): 原订阅变更指令绑定的商户原生订阅稳定引用。 minLength: 1 · maxLength: 200
- `operation.authority.instruction.membershipId` (uuid, optional): 会员的 ID。
- `operation.authority.instruction.subscriptionAction` (enum, optional): 获准对原订阅执行的动作：更新、取消、安排未来变更或释放已有安排。 Values: `"update"`, `"cancel"`, `"schedule"`, `"release"`.
- `operation.authority.instruction.supersedesOperationId` (uuid | null, optional): 原指令明确替代的订阅变更操作 UUID；没有替代关系时为 `null`。
- `operation.authority.instruction.change` (object | object | object | object | object | object, optional): 要变更到的目标。
- `operation.authority.instruction.timing` (enum, optional): 立即变更或在周期末变更；只用于契约允许的套餐变更动作。 Values: `"immediate"`, `"renewal"`.
- `operation.authority.instruction.effectiveAt` (date-time, optional): 时间（ISO 8601）。
- `operation.authority.instruction.creditMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.debitMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.totalMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.discountMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.taxMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.proration` (enum, optional): 获准执行的按比例计费策略：不按比例处理、创建按比例项目或立即开票。 Values: `"none"`, `"create_prorations"`, `"always_invoice"`.
- `operation.authority.instruction.removePriceIds` (array, optional): 此已授权订阅指令要求移除的 Longplay Price UUID 列表。 maxItems: 100
- `operation.authority.instruction.sourceLineItems` (array, optional): 原订阅变更指令冻结的变更前价格明细。历史指令可能省略。 minItems: 1 · maxItems: 100
- `operation.authority.instruction.invoiceId` (uuid, optional): 发票的 ID。
- `operation.authority.instruction.merchantInvoiceId` (string, optional): 原退款指令绑定的商户原生发票稳定引用。 minLength: 1 · maxLength: 200
- `operation.authority.instruction.amountMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 100000000
- `operation.authority.instruction.entitlementAction` (enum, optional): 退款后保留（`retain`）或撤销（`revoke`）权益。 Values: `"retain"`, `"revoke"`.
- `operation.authority.instruction.cancelSubscriptions` (array, optional): 要取消的订阅。 maxItems: 100
- `operation.authority.merchantTerms` (object, optional): 原操作已接受的商户条款；执行时以它为准，不使用浏览器传入的内容。
- `operation.authority.merchantTerms.request` (object | object | object, required): 商户收到的原准备请求，用来证明这些条款属于哪次选择。
- `operation.authority.merchantTerms.requestDigest` (string, required): 原准备请求的规范摘要。 pattern: ^[a-f0-9]{64}$
- `operation.authority.merchantTerms.merchantQuoteId` (string, required): 商户这次报价的引用。 minLength: 1 · maxLength: 200
- `operation.authority.merchantTerms.quoteTermsDigest` (string, required): 条款规范摘要；确认时绑定它，之后不可更换。 pattern: ^[a-f0-9]{64}$
- `operation.authority.merchantTerms.termsVersion` (string, required): 商户条款版本。 minLength: 1 · maxLength: 200
- `operation.authority.merchantTerms.sourceRevisions` (array, required): 报价依据的商品目录或订阅版本。 maxItems: 100
- `operation.authority.merchantTerms.observedAt` (date-time, required): 时间（ISO 8601）。
- `operation.authority.merchantTerms.expiresAt` (date-time, required): 到期时间（ISO 8601，UTC）。
- `operation.authority.merchantTerms.currency` (string, required): 已发布价格支持的币种代码。 pattern: ^[A-Z]{3}$
- `operation.authority.merchantTerms.automaticTax` (boolean, required): 税额是否由商户按自动税计算；未知税额不会当作 0。
- `operation.authority.merchantTerms.lines` (array, required): 明细行。 maxItems: 100
- `operation.authority.merchantTerms.subscriptionTerms` (object | null, required): 后续周期的订阅承诺，独立于本次扣款；非订阅时为空。
- `operation.authority.merchantTerms.subtotalMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: -200000000 · max: 200000000
- `operation.authority.merchantTerms.discountMinor` (integer, required): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.authority.merchantTerms.nativeDiscountMinor` (integer, optional): 金额，以最小货币单位计（如美分）。 min: 0 · max: 200000000
- `operation.authority.merchantTerms.discount` (object | null, optional): 折扣。
- `operation.authority.merchantTerms.taxMinor` (integer | null, required): 金额，以最小货币单位计（如美分）。
- `operation.authority.merchantTerms.totalMinor` (integer | null, required): 金额，以最小货币单位计（如美分）。
- `operation.authority.merchantTerms.effectiveAt` (date-time | null, required): 时间（ISO 8601）。
- `operation.authority.merchantTerms.expectedEffects` (array, required): 商户承诺的原生结果，用于确认展示，不代表平台余额。 maxItems: 100
- `operation.authority.merchantTerms.requiredConsents` (array, required): 确认前用户必须接受的商户条款。 maxItems: 20
- `operation.failureReason` (string | null, required): 失败原因。
- `operation.createdAt` (date-time, required): 记录创建时的 ISO 8601 UTC 时间。
- `operation.completedAt` (date-time | null, required): 时间（ISO 8601）。

<a id="errors"></a>

## 错误

失败时返回错误对象，按 `error.code` 与 `error.recovery` 处理。下表是这个接口的凭据、作用域和幂等字段决定的错误；视请求内容还可能返回 `NOT_FOUND`（引用的资源不存在）、`NOT_CONFIGURED`（所需的集成未连接）或 `PAYLOAD_TOO_LARGE`。有些拒绝（如余额不足）不是错误，而是成功响应里的 `reason`。

**可能的错误**

| code | HTTP | 何时 | recovery |
| --- | --- | --- | --- |
| `INVALID_REQUEST` | 400 | 请求不符合本页的参数。缺少或无法解析协议头时分别返回 `UNSUPPORTED_PROTOCOL_VERSION` 或 `INVALID_PROTOCOL_VERSION`。 | `fix_request` |
| `UNAUTHENTICATED` | 401 | 凭据缺失、无效、过期或已撤销。 | `authenticate` |
| `FORBIDDEN` | 403 | 凭据没有 `billing:read` 权限。 | `check_permissions` |
| `SCOPE_MISMATCH` | 403 | `X-Indiana-Project` 或 `X-Indiana-Environment` 与凭据所属的 App 和环境不一致。 | `check_scope` |
| `RATE_LIMITED` | 429 | 请求过多；按 `Retry-After` 等待后用同一请求重试。 | `retry_same_request` |
| `SERVICE_UNAVAILABLE` | 503 | 服务暂时不可用；用同一请求重试。 | `retry_same_request` |
| `INTERNAL_ERROR` | 500 | 结果未知；稍后重试。 | `recover_operation` |

- [错误码与恢复](https://www.longplayai.com/zh-hans/docs/api/errors.md)
- [请求约定](https://www.longplayai.com/zh-hans/docs/api.md)
- [全部接口](https://www.longplayai.com/zh-hans/docs/api/operations.md#invoices)
