# Read purchase operation results

Operation / SDK: `readSubscriptionOperation` · `read_subscription_operation` · `ReadSubscriptionOperation`

Read a purchase operation; use it to recover an unknown outcome.

Last updated: 2026-11-06

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

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

## Request

- **Credential**: Server Key (with `customerId`) or Customer Token, scope `billing:read`.
- **SDK**: JavaScript `createLongplayServer().readSubscriptionOperation` · JavaScript `createLongplay().readSubscriptionOperation` · Python `read_subscription_operation` · Go `ReadSubscriptionOperation`
- **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/operations/read" \
  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \
  -H "X-Indiana-Protocol: 0.10" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "a8b14e0c-6576-49a4-812c-7a1587e55255",
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"
}'
```

**TypeScript: readSubscriptionOperation.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 readSubscriptionOperation() {
  return longplay.readSubscriptionOperation({
    operationId: "a8b14e0c-6576-49a4-812c-7a1587e55255",
    customerId: "8b258f8b-4228-40fa-8d24-5b16428e686d",
  });
}
```

**Request body: request.json**

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

**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",
    "orderId": "1c5f6225-fd1a-4972-8a9d-b546c2158aed",
    "status": "complete",
    "executor": "merchant",
    "checkoutUrl": null,
    "execution": null,
    "currency": "USD",
    "catalogAmountMinor": 1000,
    "taxMinor": 0,
    "totalMinor": 1000,
    "quoteFinalized": true,
    "nativePurchase": 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, optional): 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.orderId` (uuid, required): order ID.
- `operation.append` (boolean, optional): Whether the purchase is added to the Customer's existing subscription instead of creating one.
- `operation.invoiceMode` (boolean, optional): Invoicing settings (optional).
- `operation.status` (enum, required): Status; see the allowed values. Values: `"pending"`, `"complete"`, `"cancelled"`, `"failed"`.
- `operation.executor` (enum, required): Executor; see the allowed values. Values: `"indiana"`, `"merchant"`.
- `operation.checkoutUrl` (uri | null, required): Payment page URL; empty when no redirect is needed.
- `operation.execution` (object | object | null, required): Execution details.
- `operation.execution.invoiceMode` (object, optional): Invoicing settings (optional).
- `operation.execution.invoiceMode.enabled` (boolean, required): Whether it is enabled.
- `operation.execution.invoiceMode.enable_plan_immediately` (boolean, optional): Whether to enable the Product immediately. default: false
- `operation.execution.invoiceMode.finalize` (boolean, optional): Whether to finalize immediately. default: true
- `operation.execution.invoiceMode.invoice_template_id` (string, optional): invoice template ID.
- `operation.execution.invoiceMode.net_terms_days` (integer, optional): Payment terms in days. max: 9007199254740991
- `operation.execution.append` (object, optional): Context for adding to an existing Stripe subscription; fields below.
- `operation.execution.append.subscriptionId` (string, required): Stripe subscription ID (`sub_…`). pattern: ^sub_[A-Za-z0-9]+$
- `operation.execution.append.customerId` (string, required): Stripe Customer ID (`cus_…`). pattern: ^cus_[A-Za-z0-9]+$
- `operation.execution.append.sourceItems` (array, required): Source items. minItems: 1 · maxItems: 100
- `operation.execution.append.prorationDate` (integer, required): Unix time in seconds to send as Stripe `proration_date` when adding the Products to the existing Stripe subscription; the prorated charge runs from this moment to the period end. min: 0 · max: 9007199254740991
- `operation.execution.append.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. max: 9007199254740991
- `operation.execution.append.periodStartMs` (number, required): Period start (Unix milliseconds).
- `operation.execution.append.periodEndMs` (number, required): Period end (Unix milliseconds).
- `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.mode` (enum | enum, required): Mode; see the allowed values.
- `operation.execution.lineItems` (array | array, required): Line items.
- `operation.execution.lineItems.price` (string | null, optional): Stripe Price ID (`price_…`).
- `operation.execution.lineItems.quantity` (integer | integer, required): Quantity (integer).
- `operation.execution.lineItems.priceId` (uuid | uuid, required): UUID of the catalog Price this line item bills; `price` is the Stripe Price bound to it.
- `operation.execution.lineItems.productName` (string, optional): Product name. minLength: 1 · maxLength: 80
- `operation.execution.lineItems.amountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.execution.lineItems.currency` (string, optional): Currency code supported by the published price. pattern: ^[a-z]{3}$
- `operation.execution.lineItems.interval` (enum | enum, required): Interval; see the allowed values.
- `operation.execution.lineItems.intervalCount` (integer | integer, required): Stripe Price billing interval count, at most 52.
- `operation.execution.lineItems.slot` (enum, optional): Which Stripe Price of that Price the line uses: `stripe_price_id` is its regular Stripe Price; `stripe_empty_price_id` is a zero-amount recurring Stripe Price for a metered Price, added only when no other recurring item keeps the subscription, with usage billed at renewal. Values: `"stripe_price_id"`, `"stripe_empty_price_id"`.
- `operation.execution.lineItems.tiers` (object | null | object | null, required): Price tiers.
- `operation.execution.lineItems.productVersionId` (uuid, optional): Product Version ID.
- `operation.execution.lineItems.productId` (string, optional): Product ID. minLength: 1 · maxLength: 200
- `operation.execution.lineItems.unitAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.execution.lineItems.totalMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.execution.lineItems.kind` (enum, optional): Kind; see the allowed values. Values: `"fixed"`, `"prepaid"`, `"seat"`.
- `operation.execution.discounts` (array, optional): Discounts. maxItems: 1
- `operation.execution.discounts.coupon` (string, required): Coupon. pattern: ^[A-Za-z0-9_-]{1,200}$
- `operation.execution.discounts.terms` (object, required): Terms.
- `operation.execution.trialPeriodDays` (integer | null | integer | null, required): Number of days.
- `operation.execution.metadata` (object, optional): Custom key-value data.
- `operation.execution.metadata.grooveCheckoutId` (uuid, required): Attribution field Longplay writes into Stripe `metadata`; copy it unchanged.
- `operation.execution.metadata.grooveCustomerId` (uuid, required): Attribution field Longplay writes into Stripe `metadata`; copy it unchanged.
- `operation.execution.expiresAt` (date-time | date-time, required): Expiry time (ISO 8601, UTC).
- `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.currency` (string, optional): Currency code supported by the published price. pattern: ^[A-Z]{3}$
- `operation.execution.type` ("purchase", optional): Kind of original merchant instruction: purchase, subscription change or refund. It selects the frozen commercial parameters.
- `operation.execution.catalogAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.execution.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.execution.discount` (object | null, optional): Discount.
- `operation.execution.discount.grantId` (uuid, required): grant ID.
- `operation.execution.discount.couponId` (uuid, required): Coupon UUID in the current App and environment.
- `operation.execution.discount.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.execution.discount.applicationPolicy` (enum, optional): How this offer combines with native price discounts: replace the native discount, or stack this offer with it. Values: `"replace"`, `"stack_native"`.
- `operation.execution.discount.applicableProductIds` (array, optional): Merchant-native Product identifiers eligible for this offer in the current App and environment. minItems: 1 · maxItems: 100
- `operation.execution.discount.terms` (object | object, required): Terms.
- `operation.execution.discount.duration` (object | object | object, required): Duration.
- `operation.execution.automaticTax` (boolean, optional): Whether the original purchase requires the merchant's automatic-tax capability. The requirement is frozen with the quote and executed by the native payment flow.
- `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.catalogAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.taxMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.totalMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `operation.quoteFinalized` (boolean, required): Whether the quote is final.
- `operation.nativePurchase` (object | null, required): Native purchase details.
- `operation.nativePurchase.type` ("native_purchase", required): Always `native_purchase`: complete the purchase in the App Store or Google Play using these terms.
- `operation.nativePurchase.receiptId` (uuid, required): receipt ID.
- `operation.nativePurchase.orderId` (uuid, required): order ID.
- `operation.nativePurchase.productVersionId` (uuid, required): Product Version ID.
- `operation.nativePurchase.provider` (enum, required): Payment provider; see the allowed values. Values: `"apple"`, `"google"`.
- `operation.nativePurchase.productId` (string, required): Product ID. minLength: 1 · maxLength: 255
- `operation.nativePurchase.productKind` (enum, required): Product kind; see the allowed values. Values: `"membership"`, `"credit_pack"`, `"lifetime"`.
- `operation.nativePurchase.replacement` (object | null, required): Replacement details.
- `operation.nativePurchase.replacement.sourceOrderId` (uuid, required): Order ID of the store purchase that this Product change replaces.
- `operation.nativePurchase.replacement.sourceProductId` (string, required): App Store or Google Play product ID of the subscription being replaced. minLength: 1 · maxLength: 255
- `operation.nativePurchase.replacement.policy` (enum, required): Policy. Values: `"apple_store"`, `"google_full_price"`.
- `operation.nativePurchase.replacement.sourceAccountTokens` (array, required): Source account tokens. maxItems: 50
- `operation.nativePurchase.appAccountToken` (uuid, optional): Apple `appAccountToken`.
- `operation.nativePurchase.obfuscatedAccountId` (string, optional): Google Play only: pass it as `obfuscatedAccountId` in the billing flow. It is a stable digest that identifies this Customer in this App and environment. minLength: 1 · maxLength: 64
- `operation.nativePurchase.obfuscatedProfileId` (uuid, optional): Google Play only: pass it as `obfuscatedProfileId` in the billing flow. It equals `orderId`, so the store purchase can be matched to this order.
- `operation.nativePurchase.basePlanId` (string, optional): Google Play base plan ID of the subscription to buy; present only for Google Play memberships. minLength: 1 · maxLength: 255
- `operation.nativePurchase.offerId` (string, optional): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons. minLength: 1 · maxLength: 255
- `operation.nativePurchase.offerKind` (enum, required): Offer kind; see the allowed values. Values: `"none"`, `"introductory"`, `"promotional"`.
- `operation.nativePurchase.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.nativePurchase.catalogAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.nativePurchase.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.nativePurchase.trialDays` (integer | null, required): Trial days.
- `operation.nativePurchase.seatBundle` (array, required): Seat bundle. maxItems: 20
- `operation.nativePurchase.seatBundle.key` (string, required): Key of a seat license whose seats this store purchase includes; `quantity` is the number of seats. pattern: ^[a-z][a-z0-9_]{0,63}$
- `operation.nativePurchase.seatBundle.quantity` (integer, required): Quantity (integer). min: 1 · max: 10000
- `operation.nativePurchase.applePromotionalOffer` (object | null, required): Signed Apple promotional offer.
- `operation.nativePurchase.applePromotionalOffer.offerId` (string, required): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons. minLength: 1 · maxLength: 255
- `operation.nativePurchase.applePromotionalOffer.keyId` (string, required): ID of the App Store Connect subscription key that signed this offer; pass it to StoreKit as `keyID` with `nonce`, `signature` and `timestamp`. minLength: 1 · maxLength: 255
- `operation.nativePurchase.applePromotionalOffer.nonce` (uuid, required): Nonce used for signing.
- `operation.nativePurchase.applePromotionalOffer.signature` (string, required): Signature. minLength: 1 · maxLength: 1024
- `operation.nativePurchase.applePromotionalOffer.timestamp` (integer, required): Timestamp. min: 0 · max: 9007199254740991
- `operation.confirmedAt` (date-time | null, optional): Timestamp (ISO 8601).
- `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.entityId` (uuid | null, required): Entity ID within the current customer scope, for configured Entity and license Features.
- `operation.quote.billingSubscriptionId` (uuid | null, required): billing subscription ID.
- `operation.quote.discount` (object | null, required): Discount.
- `operation.quote.discount.offerId` (uuid, required): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons.
- `operation.quote.discount.couponId` (uuid, required): Coupon UUID in the current App and environment.
- `operation.quote.discount.discount` (object | object, required): Discount.
- `operation.quote.discount.duration` (object | object | object, required): Duration.
- `operation.quote.discount.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.discount.allocations` (array, required): Balance allocations involved in this evaluation or ledger operation. minItems: 1 · maxItems: 20
- `operation.quote.discount.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `operation.quote.charge` (object | null, required): Prorated charge for adding the Products to the existing Stripe subscription in `billingSubscriptionId`, from `effectiveAt` to `periodEndsAt`; `null` for a new purchase.
- `operation.quote.charge.effectiveAt` (date-time, required): Timestamp (ISO 8601).
- `operation.quote.charge.periodEndsAt` (date-time, required): Timestamp (ISO 8601).
- `operation.quote.charge.debitMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.charge.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.charge.taxMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.charge.totalMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `operation.quote.provider` (enum, required): Payment provider; see the allowed values. Values: `"stripe"`, `"apple"`, `"google"`, `"merchant"`.
- `operation.quote.nativeOffer` (object, optional): App Store or Google Play offer selection.
- `operation.quote.nativeOffer.offerKind` (enum, required): Offer kind; see the allowed values. Values: `"none"`, `"introductory"`, `"promotional"`.
- `operation.quote.nativeOffer.offerId` (string | null, required): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons.
- `operation.quote.nativeOffer.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.nativeOffer.trialDays` (integer | null, required): Trial days.
- `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.lines` (array, required): Line items. minItems: 1 · maxItems: 20
- `operation.quote.lines.lineId` (uuid, required): ID of this quote line, unique within the quote.
- `operation.quote.lines.productVersionId` (uuid, required): Product Version ID.
- `operation.quote.lines.productName` (string, required): Product name. minLength: 1 · maxLength: 80
- `operation.quote.lines.interval` (enum, required): Interval; see the allowed values. Values: `"free"`, `"week"`, `"month"`, `"year"`, `"one_time"`.
- `operation.quote.lines.intervalCount` (integer, optional): Charging interval count: up to 156 weeks, 36 months or 3 years; omitted means 1. Not accepted for free or one_time. Allowance resets remain independent. min: 1 · max: 156
- `operation.quote.lines.baseAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.lines.seats` (array, required): Seats. maxItems: 20
- `operation.quote.lines.prepaid` (array, optional): Prepaid Feature quantities itemized on this line. The API currently returns an empty array; prepaid pack charges are included in `baseAmountMinor`. maxItems: 100
- `operation.quote.lines.catalogAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.lines.trial` (object | null, required): Trial.
- `operation.quote.catalogAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.automaticTax` (boolean, required): Whether Stripe automatic tax applies to this purchase; when `true`, Stripe calculates tax at Checkout in addition to the quoted amounts.
- `operation.quote.execution` (object | object | null, required): Execution details.
- `operation.quote.execution.invoiceMode` (object, optional): Invoicing settings (optional).
- `operation.quote.execution.append` (object, optional): Context for adding to an existing Stripe subscription; fields below.
- `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.mode` (enum | enum, required): Mode; see the allowed values.
- `operation.quote.execution.lineItems` (array | array, required): Line items.
- `operation.quote.execution.discounts` (array, optional): Discounts. maxItems: 1
- `operation.quote.execution.trialPeriodDays` (integer | null | integer | null, required): Number of days.
- `operation.quote.execution.metadata` (object, optional): Custom key-value data.
- `operation.quote.execution.expiresAt` (date-time | date-time, required): Expiry time (ISO 8601, UTC).
- `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.currency` (string, optional): Currency code supported by the published price. pattern: ^[A-Z]{3}$
- `operation.quote.execution.type` ("purchase", optional): Kind of original merchant instruction: purchase, subscription change or refund. It selects the frozen commercial parameters.
- `operation.quote.execution.catalogAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.execution.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `operation.quote.execution.discount` (object | null, optional): Discount.
- `operation.quote.execution.automaticTax` (boolean, optional): Whether the original purchase requires the merchant's automatic-tax capability. The requirement is frozen with the quote and executed by the native payment flow.
- `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

<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#commerce)
