# Read refund operation results

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

Read the result of a refund operation.

Last updated: 2026-11-06

[Web version](https://www.longplayai.com/docs/api/read-refund)

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

## Request

- **Credential**: Server Key with `billing:read`. Call from your backend only.
- **SDK**: JavaScript `createLongplayServer().readRefund` · Python `read_refund` · Go `ReadRefund`
- **Success**: HTTP 200

> In `record_only` mode, the merchant must support the merchant bridge v4 `operation.prepare` command before Longplay can freeze a quote and produce `merchantTerms`. Submit the matching `merchantConfirmation` when confirming the quote.

- [Merchant-prepared quotes](https://www.longplayai.com/docs/guides/merchant-execution.md#prepared-terms)

The response shows example data.

**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 body: request.json**

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

**Response: 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>

## Body parameters

**application/json**

- `operationId` (uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `customerId` (uuid, required): The Customer's UUID.

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

## Response fields

Every successful response includes `requestId` (this request's ID, for support) and `scope` (App and environment).

**HTTP 200 · application/json**

- `requestId` (uuid, required): UUID the server generated for this HTTP request; include it when reporting a problem. It is not your business requestId.
- `scope` (object, required): The App and environment of this response. Headers only verify scope; they cannot switch key scope.
- `scope.projectId` (string, required): App ID bound to the credential. minLength: 1
- `scope.environment` (enum, required): Separate data scope: sandbox or live. Values: `"sandbox"`, `"live"`.
- `operation` (object, required): The operation: status, result and recovery details.
- `operation.operationId` (uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.invoiceId` (uuid, required): invoice ID.
- `operation.providerInvoiceId` (string, required): provider invoice ID. minLength: 1 · maxLength: 200
- `operation.status` (enum, required): Status; see the allowed values. Values: `"quoted"`, `"pending"`, `"succeeded"`, `"failed"`, `"expired"`.
- `operation.executor` (enum, required): Executor; see the allowed values. Values: `"indiana"`, `"merchant"`.
- `operation.currency` (enum, required): Currency code supported by the published price. 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): Amount in the currency's minor unit, such as cents. max: 200000000
- `operation.mode` (enum, required): Mode; see the allowed values. Values: `"full"`, `"partial"`.
- `operation.entitlementAction` (enum, required): Keep (`retain`) or revoke (`revoke`) access after the refund. Values: `"retain"`, `"revoke"`.
- `operation.refundId` (string | null, required): Stripe refund ID (`re_...` or `pyr_...`) once the refund exists in Stripe; `null` before then. Always set when `status` is `succeeded`.
- `operation.quote` (object, optional): Quote.
- `operation.quote.operationId` (uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.quote.merchantTerms` (object, optional): Terms the merchant prepared; when present they decide the money and recurring commitment.
- `operation.quote.merchantTerms.request` (object | object | object, required): Original preparation request, proving which selection these terms answer.
- `operation.quote.merchantTerms.requestDigest` (string, required): Canonical digest of the original preparation request. pattern: ^[a-f0-9]{64}$
- `operation.quote.merchantTerms.merchantQuoteId` (string, required): Merchant reference of this quote. minLength: 1 · maxLength: 200
- `operation.quote.merchantTerms.quoteTermsDigest` (string, required): Canonical digest of these terms; confirmation binds it and later terms cannot replace it. pattern: ^[a-f0-9]{64}$
- `operation.quote.merchantTerms.termsVersion` (string, required): Merchant terms version. minLength: 1 · maxLength: 200
- `operation.quote.merchantTerms.sourceRevisions` (array, required): Catalog or subscription revisions this quote is based on. maxItems: 100
- `operation.quote.merchantTerms.observedAt` (date-time, required): Timestamp (ISO 8601).
- `operation.quote.merchantTerms.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `operation.quote.merchantTerms.currency` (string, required): Currency code supported by the published price. pattern: ^[A-Z]{3}$
- `operation.quote.merchantTerms.automaticTax` (boolean, required): Whether the merchant calculates tax automatically; unknown tax is never treated as zero.
- `operation.quote.merchantTerms.lines` (array, required): Line items. maxItems: 100
- `operation.quote.merchantTerms.subscriptionTerms` (object | null, required): Recurring commitment after this charge; null when not a subscription.
- `operation.quote.merchantTerms.subtotalMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: -200000000 · max: 200000000
- `operation.quote.merchantTerms.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.quote.merchantTerms.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.quote.merchantTerms.discount` (object | null, optional): Discount.
- `operation.quote.merchantTerms.taxMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `operation.quote.merchantTerms.totalMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `operation.quote.merchantTerms.effectiveAt` (date-time | null, required): Timestamp (ISO 8601).
- `operation.quote.merchantTerms.expectedEffects` (array, required): Native effects the merchant promises, shown for confirmation; not a platform balance. maxItems: 100
- `operation.quote.merchantTerms.requiredConsents` (array, required): Merchant terms the user must accept before confirmation. maxItems: 20
- `operation.quote.invoiceId` (uuid, required): invoice ID.
- `operation.quote.providerInvoiceId` (string, required): provider invoice ID. minLength: 1 · maxLength: 200
- `operation.quote.currency` (enum, required): Currency code supported by the published price. 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): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.quote.refundedMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.quote.pendingMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.quote.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. max: 200000000
- `operation.quote.mode` (enum, required): Mode; see the allowed values. Values: `"full"`, `"partial"`.
- `operation.quote.entitlementAction` (enum, required): Keep (`retain`) or revoke (`revoke`) access after the refund. Values: `"retain"`, `"revoke"`.
- `operation.quote.revokes` (object, required): What `entitlementAction: "revoke"` ends: the Customer's Products this invoice paid for and the Stripe subscriptions cancelled immediately with the refund. Both lists are empty when `entitlementAction` is `retain`.
- `operation.quote.revokes.customerProductIds` (array, required): IDs of the Customer's Products (the same IDs as `membershipId`) paid for by this invoice that the refund ends: one-time Products immediately, subscription Products when their Stripe subscription is cancelled. maxItems: 100
- `operation.quote.revokes.subscriptionIds` (array, required): subscription IDs. maxItems: 20
- `operation.quote.execution` (object | object, required): Execution details.
- `operation.quote.execution.provider` ("stripe" | "merchant", required): Payment provider; see the allowed values.
- `operation.quote.execution.executor` (enum | "merchant", required): Executor; see the allowed values.
- `operation.quote.execution.accountId` (string, optional): Stripe account ID (`acct_…`). pattern: ^acct_[A-Za-z0-9]+$
- `operation.quote.execution.invoice` (string, optional): Stripe invoice ID (`in_…`). pattern: ^in_[A-Za-z0-9]+$
- `operation.quote.execution.amountMinor` (integer | integer, required): Amount in the currency's minor unit, such as cents.
- `operation.quote.execution.currency` (string | string, required): Currency code supported by the published price.
- `operation.quote.execution.metadata` (object, optional): Custom key-value data.
- `operation.quote.execution.idempotencyKey` (string, optional): Stable business idempotency key. The same key and payload replay the result; do not randomize on retries. pattern: ^indiana-refund-[0-9a-f-]{36}$
- `operation.quote.execution.cancelSubscriptions` (array | array, required): Subscriptions to cancel.
- `operation.quote.execution.operationId` (uuid, optional): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.quote.execution.customerId` (uuid, optional): The Customer's UUID.
- `operation.quote.execution.configurationRevision` (integer, optional): Scan configuration revision. min: 0 · max: 9007199254740991
- `operation.quote.execution.connectionRevision` (integer, optional): Merchant connection revision frozen with this instruction, used to check that the original operation still uses the same connection configuration. min: 0 · max: 9007199254740991
- `operation.quote.execution.expiresAt` (date-time, optional): Expiry time (ISO 8601, UTC).
- `operation.quote.execution.type` ("refund", optional): Kind of original merchant instruction: purchase, subscription change or refund. It selects the frozen commercial parameters.
- `operation.quote.execution.invoiceId` (uuid, optional): invoice ID.
- `operation.quote.execution.merchantInvoiceId` (string, optional): Stable merchant-native Invoice reference for this refund. minLength: 1 · maxLength: 200
- `operation.quote.execution.mode` (enum, optional): Mode; see the allowed values. Values: `"full"`, `"partial"`.
- `operation.quote.execution.entitlementAction` (enum, optional): Keep (`retain`) or revoke (`revoke`) access after the refund. Values: `"retain"`, `"revoke"`.
- `operation.quote.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `operation.execution` (object | object | null, required): Execution details.
- `operation.execution.provider` ("stripe" | "merchant", required): Payment provider; see the allowed values.
- `operation.execution.executor` (enum | "merchant", required): Executor; see the allowed values.
- `operation.execution.accountId` (string, optional): Stripe account ID (`acct_…`). pattern: ^acct_[A-Za-z0-9]+$
- `operation.execution.invoice` (string, optional): Stripe invoice ID (`in_…`). pattern: ^in_[A-Za-z0-9]+$
- `operation.execution.amountMinor` (integer | integer, required): Amount in the currency's minor unit, such as cents.
- `operation.execution.currency` (string | string, required): Currency code supported by the published price.
- `operation.execution.metadata` (object, optional): Custom key-value data.
- `operation.execution.metadata.indianaRefundId` (uuid, required): Refund operation ID (equal to `operationId`) that the Stripe refund must carry unchanged in its metadata, so the refund is matched to this operation.
- `operation.execution.idempotencyKey` (string, optional): Stable business idempotency key. The same key and payload replay the result; do not randomize on retries. pattern: ^indiana-refund-[0-9a-f-]{36}$
- `operation.execution.cancelSubscriptions` (array | array, required): Subscriptions to cancel.
- `operation.execution.operationId` (uuid, optional): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.execution.customerId` (uuid, optional): The Customer's UUID.
- `operation.execution.configurationRevision` (integer, optional): Scan configuration revision. min: 0 · max: 9007199254740991
- `operation.execution.connectionRevision` (integer, optional): Merchant connection revision frozen with this instruction, used to check that the original operation still uses the same connection configuration. min: 0 · max: 9007199254740991
- `operation.execution.expiresAt` (date-time, optional): Expiry time (ISO 8601, UTC).
- `operation.execution.type` ("refund", optional): Kind of original merchant instruction: purchase, subscription change or refund. It selects the frozen commercial parameters.
- `operation.execution.invoiceId` (uuid, optional): invoice ID.
- `operation.execution.merchantInvoiceId` (string, optional): Stable merchant-native Invoice reference for this refund. minLength: 1 · maxLength: 200
- `operation.execution.mode` (enum, optional): Mode; see the allowed values. Values: `"full"`, `"partial"`.
- `operation.execution.entitlementAction` (enum, optional): Keep (`retain`) or revoke (`revoke`) access after the refund. Values: `"retain"`, `"revoke"`.
- `operation.confirmedAt` (date-time | null, optional): Timestamp (ISO 8601).
- `operation.merchantExecution` (object | object | object | null, optional): Snapshot of the merchant's original execution, with separate payment, fulfillment and Longplay recording states.
- `operation.merchantExecution.operationId` (uuid | uuid | uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.merchantExecution.customerId` (uuid | uuid | uuid, required): The Customer UUID.
- `operation.merchantExecution.merchantExecutionId` (string | string | string, required): Stable execution reference retained by the merchant for the original operation and reused when reading or recovering it.
- `operation.merchantExecution.fulfillmentStatus` (enum | enum | enum, required): Progress or outcome of native merchant fulfillment: not started, pending, applied, failed or not applicable.
- `operation.merchantExecution.recordingStatus` (enum | enum | enum, required): Progress of recording the execution result in Longplay. Payment and native fulfillment outcomes remain separate states.
- `operation.merchantExecution.updatedAt` (date-time | date-time | date-time, required): ISO 8601 UTC time of the last record update.
- `operation.merchantExecution.problem` (object | null | object | null | object | null, required): Problem recorded in this execution snapshot, including its phase, error code and recovery advice for the original operation; `null` when absent.
- `operation.merchantExecution.problem.phase` (enum | enum | enum, required): Phase affected by the problem: execution, payment, fulfillment or recording in Longplay.
- `operation.merchantExecution.problem.code` (enum | enum | enum, required): Structured API error code for this problem, interpreted with its phase and recovery advice for the original operation.
- `operation.merchantExecution.problem.reason` (enum | enum | enum, optional): Specific reason for this error. `RESULT_UNKNOWN` means the financial outcome is unconfirmed and requires recovery of the original operation.
- `operation.merchantExecution.problem.recovery` (enum | enum | enum, required): Next recovery action for the original operation. Follow `recover_operation` when the financial outcome is unconfirmed.
- `operation.merchantExecution.problem.retryable` (boolean | boolean | boolean, required): Whether the failed request can be retried under the supplied recovery action. It is `false` for `RESULT_UNKNOWN`; retain and recover the original operation.
- `operation.merchantExecution.pollAfterMs` (integer | null | integer | null | integer | null, required): Suggested delay in milliseconds before reading the same original operation again; `null` when no polling interval is supplied.
- `operation.merchantExecution.type` ("purchase" | "subscription_change" | "refund", required): Original operation represented by this execution snapshot: purchase, subscription change or refund.
- `operation.merchantExecution.merchantOrderId` (string | null, optional): Stable merchant order reference for the original purchase; `null` until the reference is available.
- `operation.merchantExecution.paymentStatus` (enum, optional): Payment progress or observed outcome of the original purchase. Fulfillment and Longplay recording have their own states. Values: `"not_started"`, `"pending"`, `"succeeded"`, `"not_required"`, `"failed"`, `"expired"`, `"unknown"`.
- `operation.merchantExecution.checkoutUrl` (uri | null, optional): Payment page URL; empty when no redirect is needed.
- `operation.merchantExecution.checkoutExpiresAt` (date-time | null, optional): Timestamp (ISO 8601).
- `operation.merchantExecution.status` (enum | enum, optional): Status; see the allowed values.
- `operation.merchantExecution.merchantSubscriptionId` (string, optional): Stable merchant-native subscription reference represented by this change snapshot. minLength: 1 · maxLength: 200
- `operation.merchantExecution.scheduledFor` (date-time | null, optional): ISO 8601 effective time of the scheduled original subscription change; `null` when its status is not scheduled.
- `operation.merchantExecution.nextAction` (object, optional): Optional payment handoff for the original subscription change, including the merchant-provided HTTPS payment page and its expiry. Reads and recovery keep it tied to the same original operation.
- `operation.merchantExecution.nextAction.type` ("redirect", required): Payment handoff type, always `redirect`: open the merchant-provided payment page for the original operation.
- `operation.merchantExecution.nextAction.url` (string, required): HTTPS address of the merchant's original payment page, used to complete payment or authentication for the original operation. Read the same original operation for the outcome. pattern: ^https:\/\/.*
- `operation.merchantExecution.nextAction.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `operation.merchantExecution.merchantRefundId` (string | null, optional): Stable merchant reference for the original refund; `null` until available and required for a successful refund.
- `operation.problem` (object | null, optional): Structured problem blocking the original merchant operation, including its phase, error code and recovery advice; `null` when absent.
- `operation.problem.phase` (enum, required): Phase affected by the problem: execution, payment, fulfillment or recording in Longplay. Values: `"execution"`, `"payment"`, `"fulfillment"`, `"recording"`.
- `operation.problem.code` (enum, required): Structured API error code for this problem, interpreted with its phase and recovery advice for the original operation. 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): Specific reason for this error. `RESULT_UNKNOWN` means the financial outcome is unconfirmed and requires recovery of the original operation. 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): Next recovery action for the original operation. Follow `recover_operation` when the financial outcome is unconfirmed. 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): Whether the failed request can be retried under the supplied recovery action. It is `false` for `RESULT_UNKNOWN`; retain and recover the original operation.
- `operation.authority` (object, optional): Execution authority for the original merchant operation, including App/environment, Customer, confirmation facts and the frozen commercial instruction.
- `operation.authority.scope` (object, required): The App and environment of this response. Headers only verify scope; they cannot switch key scope.
- `operation.authority.scope.projectId` (uuid, required): App ID bound to the credential.
- `operation.authority.scope.environmentId` (uuid, required): environment ID.
- `operation.authority.scope.environment` (enum, required): Separate data scope: sandbox or live. Values: `"sandbox"`, `"live"`.
- `operation.authority.operationId` (uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.authority.customerId` (uuid, required): The Customer's UUID.
- `operation.authority.confirmedAt` (date-time | null, required): Timestamp (ISO 8601).
- `operation.authority.initialExecutionAllowed` (boolean, required): Whether current authority permits an initial dispatch of the original commercial instruction. When `false`, follow the original operation's state and recovery requirements.
- `operation.authority.instruction` (object | object | object, required): Original purchase, subscription-change or refund instruction bound to this authority. Retain its operationId, Customer and frozen commercial parameters.
- `operation.authority.instruction.provider` ("merchant" | "merchant" | "merchant", required): Payment provider; see the allowed values.
- `operation.authority.instruction.executor` ("merchant" | "merchant" | "merchant", required): Executor; see the allowed values.
- `operation.authority.instruction.operationId` (uuid | uuid | uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `operation.authority.instruction.customerId` (uuid | uuid | uuid, required): The Customer UUID.
- `operation.authority.instruction.configurationRevision` (integer | integer | integer, required): Scan configuration revision.
- `operation.authority.instruction.connectionRevision` (integer | integer | integer, required): Merchant connection revision bound to the original instruction. Execution must use the connection configuration authorized for that operation.
- `operation.authority.instruction.currency` (string | string | string, required): Currency code supported by the published price.
- `operation.authority.instruction.expiresAt` (date-time | date-time | date-time, required): Expiry time (ISO 8601, UTC).
- `operation.authority.instruction.type` ("purchase" | "subscription_change" | "refund", required): Kind of original merchant instruction bound to this authority: purchase, subscription change or refund.
- `operation.authority.instruction.mode` (enum | enum, optional): Mode; see the allowed values.
- `operation.authority.instruction.lineItems` (array | array, optional): Line items.
- `operation.authority.instruction.catalogAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.discount` (object | null | object | null, optional): Discount.
- `operation.authority.instruction.trialPeriodDays` (integer | null, optional): Number of days.
- `operation.authority.instruction.automaticTax` (boolean, optional): Automatic-tax requirement frozen in this authorized purchase instruction, executed by the merchant's native payment flow.
- `operation.authority.instruction.subscriptionId` (uuid, optional): subscription ID.
- `operation.authority.instruction.merchantSubscriptionId` (string, optional): Stable merchant-native subscription reference bound to the original change instruction. minLength: 1 · maxLength: 200
- `operation.authority.instruction.membershipId` (uuid, optional): membership ID.
- `operation.authority.instruction.subscriptionAction` (enum, optional): Authorized action on the original subscription: update, cancel, schedule a future change or release an existing schedule. Values: `"update"`, `"cancel"`, `"schedule"`, `"release"`.
- `operation.authority.instruction.supersedesOperationId` (uuid | null, optional): UUID of the subscription-change operation explicitly superseded by this instruction; `null` when there is no supersession.
- `operation.authority.instruction.change` (object | object | object | object | object | object, optional): The target of the change.
- `operation.authority.instruction.timing` (enum, optional): Immediate or end-of-cycle timing, only for supported plan-change actions. Values: `"immediate"`, `"renewal"`.
- `operation.authority.instruction.effectiveAt` (date-time, optional): Timestamp (ISO 8601).
- `operation.authority.instruction.creditMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.debitMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.totalMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.discountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.taxMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.proration` (enum, optional): Authorized proration policy: none, create prorations or invoice immediately. Values: `"none"`, `"create_prorations"`, `"always_invoice"`.
- `operation.authority.instruction.removePriceIds` (array, optional): Longplay Price UUIDs that this authorized subscription instruction removes. maxItems: 100
- `operation.authority.instruction.sourceLineItems` (array, optional): Frozen pre-change prices in the original subscription instruction. Older instructions may omit them. minItems: 1 · maxItems: 100
- `operation.authority.instruction.invoiceId` (uuid, optional): invoice ID.
- `operation.authority.instruction.merchantInvoiceId` (string, optional): Stable merchant-native Invoice reference bound to the original refund instruction. minLength: 1 · maxLength: 200
- `operation.authority.instruction.amountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.authority.instruction.entitlementAction` (enum, optional): Keep (`retain`) or revoke (`revoke`) access after the refund. Values: `"retain"`, `"revoke"`.
- `operation.authority.instruction.cancelSubscriptions` (array, optional): Subscriptions to cancel. maxItems: 100
- `operation.authority.merchantTerms` (object, optional): Merchant terms accepted for the original operation; execution uses these, never browser input.
- `operation.authority.merchantTerms.request` (object | object | object, required): Original preparation request, proving which selection these terms answer.
- `operation.authority.merchantTerms.requestDigest` (string, required): Canonical digest of the original preparation request. pattern: ^[a-f0-9]{64}$
- `operation.authority.merchantTerms.merchantQuoteId` (string, required): Merchant reference of this quote. minLength: 1 · maxLength: 200
- `operation.authority.merchantTerms.quoteTermsDigest` (string, required): Canonical digest of these terms; confirmation binds it and later terms cannot replace it. pattern: ^[a-f0-9]{64}$
- `operation.authority.merchantTerms.termsVersion` (string, required): Merchant terms version. minLength: 1 · maxLength: 200
- `operation.authority.merchantTerms.sourceRevisions` (array, required): Catalog or subscription revisions this quote is based on. maxItems: 100
- `operation.authority.merchantTerms.observedAt` (date-time, required): Timestamp (ISO 8601).
- `operation.authority.merchantTerms.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `operation.authority.merchantTerms.currency` (string, required): Currency code supported by the published price. pattern: ^[A-Z]{3}$
- `operation.authority.merchantTerms.automaticTax` (boolean, required): Whether the merchant calculates tax automatically; unknown tax is never treated as zero.
- `operation.authority.merchantTerms.lines` (array, required): Line items. maxItems: 100
- `operation.authority.merchantTerms.subscriptionTerms` (object | null, required): Recurring commitment after this charge; null when not a subscription.
- `operation.authority.merchantTerms.subtotalMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: -200000000 · max: 200000000
- `operation.authority.merchantTerms.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.authority.merchantTerms.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `operation.authority.merchantTerms.discount` (object | null, optional): Discount.
- `operation.authority.merchantTerms.taxMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `operation.authority.merchantTerms.totalMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `operation.authority.merchantTerms.effectiveAt` (date-time | null, required): Timestamp (ISO 8601).
- `operation.authority.merchantTerms.expectedEffects` (array, required): Native effects the merchant promises, shown for confirmation; not a platform balance. maxItems: 100
- `operation.authority.merchantTerms.requiredConsents` (array, required): Merchant terms the user must accept before confirmation. maxItems: 20
- `operation.failureReason` (string | null, required): Failure reason.
- `operation.createdAt` (date-time, required): ISO 8601 UTC time when the record was created.
- `operation.completedAt` (date-time | null, required): Timestamp (ISO 8601).

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

## Errors

Failures return an error object; handle them by `error.code` and `error.recovery`. The table lists the errors that follow from this operation's credential, scope and idempotency fields; depending on the request it can also return `NOT_FOUND` (a referenced resource doesn't exist), `NOT_CONFIGURED` (a required integration isn't connected) or `PAYLOAD_TOO_LARGE`. Some refusals, such as insufficient balance, are not errors but a `reason` in a successful response.

**Possible errors**

| code | HTTP | When | recovery |
| --- | --- | --- | --- |
| `INVALID_REQUEST` | 400 | The request doesn't match this page's parameters. A missing or malformed protocol header returns `UNSUPPORTED_PROTOCOL_VERSION` or `INVALID_PROTOCOL_VERSION` instead. | `fix_request` |
| `UNAUTHENTICATED` | 401 | The credential is missing, invalid, expired or revoked. | `authenticate` |
| `FORBIDDEN` | 403 | The credential lacks `billing:read`. | `check_permissions` |
| `SCOPE_MISMATCH` | 403 | `X-Indiana-Project` or `X-Indiana-Environment` doesn't match the credential's App and environment. | `check_scope` |
| `RATE_LIMITED` | 429 | Too many requests; wait for `Retry-After` and retry the same request. | `retry_same_request` |
| `SERVICE_UNAVAILABLE` | 503 | The service is temporarily unavailable; retry the same request. | `retry_same_request` |
| `INTERNAL_ERROR` | 500 | The outcome is unknown; retry later. | `recover_operation` |

- [Error codes and recovery](https://www.longplayai.com/docs/api/errors.md)
- [Request conventions](https://www.longplayai.com/docs/api.md)
- [All operations](https://www.longplayai.com/docs/api/operations.md#invoices)
