# Preview a purchase quote

Operation / SDK: `previewAttach` · `preview_attach` · `PreviewAttach`

Create a fixed quote and operationId for the chosen Products, Provider and currency; no charge.

Last updated: 2026-11-06

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

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

## Request

- **Credential**: Server Key (with `customerId`) or Customer Token, scope `billing:read`.
- **SDK**: JavaScript `createLongplayServer().previewAttach` · JavaScript `createLongplay().previewAttach` · Python `preview_attach` · Go `PreviewAttach`
- **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/preview-attach" \
  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \
  -H "X-Indiana-Protocol: 0.10" \
  -H "Content-Type: application/json" \
  -d '{
  "requestId": "0f58d1f8-069f-4288-8ec1-4ed10af55b45",
  "plans": [
    {
      "productVersionId": "8c489a1a-5542-44fe-8e80-da2f6a319d01"
    }
  ],
  "provider": "stripe",
  "currency": "USD",
  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"
}'
```

**TypeScript: previewAttach.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 previewAttach() {
  return longplay.previewAttach({
    requestId: "0f58d1f8-069f-4288-8ec1-4ed10af55b45",
    plans: [
      {
        productVersionId: "8c489a1a-5542-44fe-8e80-da2f6a319d01",
      },
    ],
    provider: "stripe",
    currency: "USD",
    customerId: "8b258f8b-4228-40fa-8d24-5b16428e686d",
  });
}
```

**Request body: request.json**

```json
{
  "requestId": "0f58d1f8-069f-4288-8ec1-4ed10af55b45",
  "plans": [
    {
      "productVersionId": "8c489a1a-5542-44fe-8e80-da2f6a319d01"
    }
  ],
  "provider": "stripe",
  "currency": "USD",
  "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"
  },
  "quote": {
    "entityId": null,
    "billingSubscriptionId": null,
    "charge": null,
    "discount": null,
    "operationId": "a8b14e0c-6576-49a4-812c-7a1587e55255",
    "expiresAt": "2026-10-03T12:00:00.000Z",
    "provider": "stripe",
    "currency": "USD",
    "catalogAmountMinor": 1000,
    "automaticTax": false,
    "lines": [
      {
        "lineId": "9b9fcab5-c4ac-4ad2-8b91-dcf402115825",
        "productVersionId": "8c489a1a-5542-44fe-8e80-da2f6a319d01",
        "productName": "Pro",
        "interval": "month",
        "baseAmountMinor": 1000,
        "catalogAmountMinor": 1000,
        "seats": [],
        "trial": null
      }
    ],
    "execution": {
      "provider": "stripe",
      "executor": "merchant",
      "accountId": "acct_1Example",
      "mode": "subscription",
      "lineItems": [
        {
          "price": "price_1Example",
          "quantity": 1,
          "priceId": "e209a800-ad74-486c-8ea2-80d1bb0d65b5",
          "productName": "Pro",
          "amountMinor": 1000,
          "currency": "usd",
          "interval": "month",
          "intervalCount": 1,
          "slot": "stripe_price_id",
          "tiers": null
        }
      ],
      "discounts": [],
      "trialPeriodDays": null,
      "metadata": {
        "grooveCheckoutId": "84c1eb65-6350-4eb2-86cf-1bf4a54642bd",
        "grooveCustomerId": "f6ec000d-bef1-4872-826f-c1b83539799d"
      },
      "expiresAt": "2026-10-03T12:00:00.000Z"
    }
  }
}
```

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

## Body parameters

**application/json**

- `requestId` (uuid, required): Business request UUID. Reuse for retries of one operation; generate a new value for a new operation.
- `predecessorOperationId` (uuid, optional): previous related operation ID.
- `invoiceMode` (object, optional): Invoicing settings (optional).
- `invoiceMode.enabled` (boolean, required): Whether it is enabled.
- `invoiceMode.enable_plan_immediately` (boolean, optional): Whether to enable the Product immediately. default: false
- `invoiceMode.finalize` (boolean, optional): Whether to finalize immediately. default: true
- `invoiceMode.invoice_template_id` (string, optional): invoice template ID.
- `invoiceMode.net_terms_days` (integer, optional): Payment terms in days. max: 9007199254740991
- `entityId` (uuid, optional): Entity ID within the current customer scope, for configured Entity and license Features.
- `billingSubscriptionId` (uuid, optional): billing subscription ID.
- `newBillingSubscription` (true, optional): Stripe only: true forces a new billing subscription and cannot be combined with billingSubscriptionId. Cross-provider main-plan exclusivity still applies.
- `offerId` (uuid, optional): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons.
- `nativeOffer` (object, optional): App Store or Google Play offer selection.
- `nativeOffer.offerKind` (enum, required): Offer kind; see the allowed values. Values: `"none"`, `"introductory"`, `"promotional"`.
- `nativeOffer.offerId` (string | null, required): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons.
- `nativeOffer.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `nativeOffer.trialDays` (integer | null, required): Trial days.
- `plans` (array, required): Product Versions to buy, optionally with seat and Feature quantities. minItems: 1 · maxItems: 20
- `plans.productVersionId` (uuid, required): Product Version ID.
- `plans.seatQuantities` (object, optional): Total seats to buy for each seat license of the Product, keyed by license key (`seats.key` in the quote), as whole numbers from 0 to 10000. A license left out, or set below its included seats, gets its included seats; seats above them are charged.
- `plans.featureQuantities` (object, optional): Number of packs to buy for each prepaid Feature of the Product, keyed by Feature UUID, as whole numbers from 0 to 10000; each pack adds the Price's billing units. Every prepaid Feature of the Product needs an entry (`0` buys none).
- `provider` (enum, required): Payment provider; see the allowed values. Values: `"stripe"`, `"apple"`, `"google"`, `"merchant"`.
- `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"`.
- `funnelId` (uuid, optional): Funnel ID.
- `funnelVersionId` (uuid, optional): Funnel Version ID.
- `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"`.
- `quote` (object, required): Quote.
- `quote.operationId` (uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `quote.merchantTerms` (object, optional): Terms the merchant prepared; when present they decide the money and recurring commitment.
- `quote.merchantTerms.request` (object | object | object, required): Original preparation request, proving which selection these terms answer.
- `quote.merchantTerms.request.subject` (object | object | object, required): App, environment and Customer bound to the original preparation request.
- `quote.merchantTerms.request.operationId` (uuid | uuid | uuid, required): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `quote.merchantTerms.request.configurationRevision` (integer | integer | integer, required): Configuration revision bound to the original preparation request.
- `quote.merchantTerms.request.connectionRevision` (integer | integer | integer, required): Merchant connection revision at preparation; a changed connection requires new preparation.
- `quote.merchantTerms.request.expiresAt` (date-time | date-time | date-time, required): Expiry time (ISO 8601, UTC).
- `quote.merchantTerms.request.action` ("purchase" | "subscription_change" | "refund", required): Business action. Target fields and quantity requirements vary by action; see the request structure and example.
- `quote.merchantTerms.request.mode` (enum | enum, optional): Mode; see the allowed values.
- `quote.merchantTerms.request.currency` (string | string | string, required): Currency code supported by the published price.
- `quote.merchantTerms.request.items` (array, optional): List items. minItems: 1 · maxItems: 100
- `quote.merchantTerms.request.offerRefs` (array | array, optional): Merchant offer references included in this selection.
- `quote.merchantTerms.request.merchantSubscriptionId` (string, optional): Merchant subscription reference being changed. minLength: 1 · maxLength: 200
- `quote.merchantTerms.request.change` (object | object | object | object | object | object, optional): The target of the change.
- `quote.merchantTerms.request.timing` (enum, optional): Immediate or end-of-cycle timing, only for supported plan-change actions. Values: `"immediate"`, `"renewal"`.
- `quote.merchantTerms.request.proration` (enum, optional): Proration behavior selected for this plan change. Values: `"none"`, `"create_prorations"`, `"always_invoice"`.
- `quote.merchantTerms.request.merchantInvoiceId` (string, optional): Merchant Invoice reference being refunded. minLength: 1 · maxLength: 200
- `quote.merchantTerms.request.amountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. max: 200000000
- `quote.merchantTerms.request.entitlementAction` (enum, optional): Keep (`retain`) or revoke (`revoke`) access after the refund. Values: `"retain"`, `"revoke"`.
- `quote.merchantTerms.requestDigest` (string, required): Canonical digest of the original preparation request. pattern: ^[a-f0-9]{64}$
- `quote.merchantTerms.merchantQuoteId` (string, required): Merchant reference of this quote. minLength: 1 · maxLength: 200
- `quote.merchantTerms.quoteTermsDigest` (string, required): Canonical digest of these terms; confirmation binds it and later terms cannot replace it. pattern: ^[a-f0-9]{64}$
- `quote.merchantTerms.termsVersion` (string, required): Merchant terms version. minLength: 1 · maxLength: 200
- `quote.merchantTerms.sourceRevisions` (array, required): Catalog or subscription revisions this quote is based on. maxItems: 100
- `quote.merchantTerms.sourceRevisions.reference` (string, required): Reference of the data source behind the quote. minLength: 1 · maxLength: 200
- `quote.merchantTerms.sourceRevisions.revision` (string, required): Revision of the specific versioned resource; Customer profile updates have no revision. minLength: 1 · maxLength: 200
- `quote.merchantTerms.observedAt` (date-time, required): Timestamp (ISO 8601).
- `quote.merchantTerms.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `quote.merchantTerms.currency` (string, required): Currency code supported by the published price. pattern: ^[A-Z]{3}$
- `quote.merchantTerms.automaticTax` (boolean, required): Whether the merchant calculates tax automatically; unknown tax is never treated as zero.
- `quote.merchantTerms.lines` (array, required): Line items. maxItems: 100
- `quote.merchantTerms.lines.merchantLineId` (string, required): Stable merchant-native invoice line reference, unique within the invoice. minLength: 1 · maxLength: 200
- `quote.merchantTerms.lines.merchantPriceId` (string | null, required): Merchant price reference of this line; null when none applies.
- `quote.merchantTerms.lines.quantity` (string, required): Quantity as a decimal string, avoiding floating-point error. pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$
- `quote.merchantTerms.lines.subtotalMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: -200000000 · max: 200000000
- `quote.merchantTerms.lines.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `quote.merchantTerms.lines.taxMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `quote.merchantTerms.lines.totalMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `quote.merchantTerms.subscriptionTerms` (object | null, required): Recurring commitment after this charge; null when not a subscription.
- `quote.merchantTerms.subscriptionTerms.items` (array, required): List items. minItems: 1 · maxItems: 100
- `quote.merchantTerms.subscriptionTerms.trial` (object | null, required): Trial.
- `quote.merchantTerms.subscriptionTerms.discount` (object | null, optional): Discount.
- `quote.merchantTerms.subscriptionTerms.discountExpiresAt` (date-time | null, optional): Timestamp (ISO 8601).
- `quote.merchantTerms.subscriptionTerms.initialAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.merchantTerms.subtotalMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: -200000000 · max: 200000000
- `quote.merchantTerms.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `quote.merchantTerms.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 200000000
- `quote.merchantTerms.discount` (object | null, optional): Discount.
- `quote.merchantTerms.discount.grantId` (uuid, required): grant ID.
- `quote.merchantTerms.discount.couponId` (uuid, required): Coupon UUID in the current App and environment.
- `quote.merchantTerms.discount.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.merchantTerms.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"`.
- `quote.merchantTerms.discount.applicableProductIds` (array, optional): Merchant-native Product identifiers eligible for this offer in the current App and environment. minItems: 1 · maxItems: 100
- `quote.merchantTerms.discount.terms` (object | object, required): Terms.
- `quote.merchantTerms.discount.duration` (object | object | object, required): Duration.
- `quote.merchantTerms.taxMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `quote.merchantTerms.totalMinor` (integer | null, required): Amount in the currency's minor unit, such as cents.
- `quote.merchantTerms.effectiveAt` (date-time | null, required): Timestamp (ISO 8601).
- `quote.merchantTerms.expectedEffects` (array, required): Native effects the merchant promises, shown for confirmation; not a platform balance. maxItems: 100
- `quote.merchantTerms.expectedEffects.reference` (string, required): Stable reference of this expected effect. minLength: 1 · maxLength: 200
- `quote.merchantTerms.expectedEffects.kind` (enum, required): Kind; see the allowed values. Values: `"grant"`, `"revoke"`, `"change"`.
- `quote.merchantTerms.expectedEffects.description` (string, required): Description. minLength: 1 · maxLength: 1000
- `quote.merchantTerms.expectedEffects.quantity` (string | null, required): Quantity as a decimal string, avoiding floating-point error.
- `quote.merchantTerms.expectedEffects.unit` (string | null, required): Merchant unit of the quantity; null when no quantity applies.
- `quote.merchantTerms.requiredConsents` (array, required): Merchant terms the user must accept before confirmation. maxItems: 20
- `quote.merchantTerms.requiredConsents.reference` (string, required): Stable reference of this required consent. minLength: 1 · maxLength: 200
- `quote.merchantTerms.requiredConsents.version` (string, required): Version number. minLength: 1 · maxLength: 200
- `quote.merchantTerms.requiredConsents.summary` (string, required): Summary of the consent shown to the user. minLength: 1 · maxLength: 1000
- `quote.entityId` (uuid | null, required): Entity ID within the current customer scope, for configured Entity and license Features.
- `quote.billingSubscriptionId` (uuid | null, required): billing subscription ID.
- `quote.discount` (object | null, required): Discount.
- `quote.discount.offerId` (uuid, required): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons.
- `quote.discount.couponId` (uuid, required): Coupon UUID in the current App and environment.
- `quote.discount.discount` (object | object, required): Discount.
- `quote.discount.discount.type` ("percent" | "amount", required): Kind of discount: `percent` takes `percentOff` percent off; `amount` takes `amountOffCents` off, in minor units of `currency`.
- `quote.discount.discount.percentOff` (number, optional): Percentage off. min: 1 · max: 100
- `quote.discount.discount.amountOffCents` (integer, optional): Amount off in minor units. min: 1 · max: 100000000
- `quote.discount.discount.currency` (enum, optional): 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"`.
- `quote.discount.duration` (object | object | object, required): Duration.
- `quote.discount.duration.type` ("once" | "repeating" | "forever", required): How long it applies: `once` to a single invoice, `repeating` for the number of months in `months`, and `forever` with no end.
- `quote.discount.duration.months` (integer, optional): Number of months. min: 1 · max: 36
- `quote.discount.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.discount.allocations` (array, required): Balance allocations involved in this evaluation or ledger operation. minItems: 1 · maxItems: 20
- `quote.discount.allocations.productVersionId` (uuid, required): Product Version ID.
- `quote.discount.allocations.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.discount.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `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.
- `quote.charge.effectiveAt` (date-time, required): Timestamp (ISO 8601).
- `quote.charge.periodEndsAt` (date-time, required): Timestamp (ISO 8601).
- `quote.charge.debitMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.charge.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.charge.taxMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.charge.totalMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.expiresAt` (date-time, required): Expiry time (ISO 8601, UTC).
- `quote.provider` (enum, required): Payment provider; see the allowed values. Values: `"stripe"`, `"apple"`, `"google"`, `"merchant"`.
- `quote.nativeOffer` (object, optional): App Store or Google Play offer selection.
- `quote.nativeOffer.offerKind` (enum, required): Offer kind; see the allowed values. Values: `"none"`, `"introductory"`, `"promotional"`.
- `quote.nativeOffer.offerId` (string | null, required): ID of an offer the Customer has claimed, for new purchases; existing subscriptions use setBillingCoupons.
- `quote.nativeOffer.discountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.nativeOffer.trialDays` (integer | null, required): Trial days.
- `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"`.
- `quote.lines` (array, required): Line items. minItems: 1 · maxItems: 20
- `quote.lines.lineId` (uuid, required): ID of this quote line, unique within the quote.
- `quote.lines.productVersionId` (uuid, required): Product Version ID.
- `quote.lines.productName` (string, required): Product name. minLength: 1 · maxLength: 80
- `quote.lines.interval` (enum, required): Interval; see the allowed values. Values: `"free"`, `"week"`, `"month"`, `"year"`, `"one_time"`.
- `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
- `quote.lines.baseAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.lines.seats` (array, required): Seats. maxItems: 20
- `quote.lines.seats.key` (string, required): Key of a seat license included in this Product; use it in `plans.seatQuantities` and as `change.licenseKey` in `previewUpdate`. minLength: 1 · maxLength: 64 · pattern: ^[a-z][a-z0-9_]*$
- `quote.lines.seats.quantity` (integer, required): Quantity (integer). min: 0 · max: 10000
- `quote.lines.seats.includedQuantity` (integer, required): Seats included in the Product price at no extra charge; `quantity` is never below this. min: 0 · max: 10000
- `quote.lines.seats.maximumQuantity` (integer, required): Largest seat total you can request for this license (10000). min: 0 · max: 10000
- `quote.lines.seats.unitAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `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
- `quote.lines.prepaid.itemKey` (string, required): Item key. pattern: ^paid:feature:[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
- `quote.lines.prepaid.internal_feature_id` (uuid, required): Feature ID.
- `quote.lines.prepaid.includedAmount` (string, required): Amount of this Feature included before any purchased packs, as a decimal string; the total allowance is this plus `terms.units` × `quantity`. pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$
- `quote.lines.prepaid.quantity` (integer, required): Quantity (integer). min: 0 · max: 10000
- `quote.lines.prepaid.terms` (object, required): Terms.
- `quote.lines.prepaid.pricing` (object, optional): Pricing details.
- `quote.lines.prepaid.unitAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.lines.prepaid.productId` (string | null, required): Product ID.
- `quote.lines.prepaid.priceId` (string | null, required): Payment provider Price ID bound to this prepaid pack, such as a Stripe Price ID; `null` together with `productId` when no Price is bound, which is allowed only when nothing is charged for the pack.
- `quote.lines.catalogAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.lines.trial` (object | null, required): Trial.
- `quote.lines.trial.days` (integer, required): Number of days. min: 1 · max: 730
- `quote.lines.trial.cardRequired` (boolean, required): Whether the trial collects a payment method first. When `false` on a Stripe quote without `invoiceMode`, there is no `execution`: `attach` starts the trial immediately without Checkout, and no coupon applies.
- `quote.catalogAmountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `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.
- `quote.execution` (object | object | null, required): Execution details.
- `quote.execution.invoiceMode` (object, optional): Invoicing settings (optional).
- `quote.execution.invoiceMode.enabled` (boolean, required): Whether it is enabled.
- `quote.execution.invoiceMode.enable_plan_immediately` (boolean, optional): Whether to enable the Product immediately. default: false
- `quote.execution.invoiceMode.finalize` (boolean, optional): Whether to finalize immediately. default: true
- `quote.execution.invoiceMode.invoice_template_id` (string, optional): invoice template ID.
- `quote.execution.invoiceMode.net_terms_days` (integer, optional): Payment terms in days. max: 9007199254740991
- `quote.execution.append` (object, optional): Context for adding to an existing Stripe subscription; fields below.
- `quote.execution.append.subscriptionId` (string, required): Stripe subscription ID (`sub_…`). pattern: ^sub_[A-Za-z0-9]+$
- `quote.execution.append.customerId` (string, required): Stripe Customer ID (`cus_…`). pattern: ^cus_[A-Za-z0-9]+$
- `quote.execution.append.sourceItems` (array, required): Source items. minItems: 1 · maxItems: 100
- `quote.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
- `quote.execution.append.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. max: 9007199254740991
- `quote.execution.append.periodStartMs` (number, required): Period start (Unix milliseconds).
- `quote.execution.append.periodEndMs` (number, required): Period end (Unix milliseconds).
- `quote.execution.provider` ("stripe" | "merchant", required): Payment provider; see the allowed values.
- `quote.execution.executor` (enum | "merchant", required): Executor; see the allowed values.
- `quote.execution.accountId` (string, optional): Stripe account ID (`acct_…`). pattern: ^acct_[A-Za-z0-9]+$
- `quote.execution.mode` (enum | enum, required): Mode; see the allowed values.
- `quote.execution.lineItems` (array | array, required): Line items.
- `quote.execution.lineItems.price` (string | null, optional): Stripe Price ID (`price_…`).
- `quote.execution.lineItems.quantity` (integer | integer, required): Quantity (integer).
- `quote.execution.lineItems.priceId` (uuid | uuid, required): UUID of the catalog Price this line item bills; `price` is the Stripe Price bound to it.
- `quote.execution.lineItems.productName` (string, optional): Product name. minLength: 1 · maxLength: 80
- `quote.execution.lineItems.amountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.execution.lineItems.currency` (string, optional): Currency code supported by the published price. pattern: ^[a-z]{3}$
- `quote.execution.lineItems.interval` (enum | enum, required): Interval; see the allowed values.
- `quote.execution.lineItems.intervalCount` (integer | integer, required): Stripe Price billing interval count, at most 52.
- `quote.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"`.
- `quote.execution.lineItems.tiers` (object | null | object | null, required): Price tiers.
- `quote.execution.lineItems.productVersionId` (uuid, optional): Product Version ID.
- `quote.execution.lineItems.productId` (string, optional): Product ID. minLength: 1 · maxLength: 200
- `quote.execution.lineItems.unitAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.execution.lineItems.totalMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.execution.lineItems.kind` (enum, optional): Kind; see the allowed values. Values: `"fixed"`, `"prepaid"`, `"seat"`.
- `quote.execution.discounts` (array, optional): Discounts. maxItems: 1
- `quote.execution.discounts.coupon` (string, required): Coupon. pattern: ^[A-Za-z0-9_-]{1,200}$
- `quote.execution.discounts.terms` (object, required): Terms.
- `quote.execution.trialPeriodDays` (integer | null | integer | null, required): Number of days.
- `quote.execution.metadata` (object, optional): Custom key-value data.
- `quote.execution.metadata.grooveCheckoutId` (uuid, required): Attribution field Longplay writes into Stripe `metadata`; copy it unchanged.
- `quote.execution.metadata.grooveCustomerId` (uuid, required): Attribution field Longplay writes into Stripe `metadata`; copy it unchanged.
- `quote.execution.expiresAt` (date-time | date-time, required): Expiry time (ISO 8601, UTC).
- `quote.execution.operationId` (uuid, optional): Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.
- `quote.execution.customerId` (uuid, optional): The Customer's UUID.
- `quote.execution.configurationRevision` (integer, optional): Scan configuration revision. min: 0 · max: 9007199254740991
- `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
- `quote.execution.currency` (string, optional): Currency code supported by the published price. pattern: ^[A-Z]{3}$
- `quote.execution.type` ("purchase", optional): Kind of original merchant instruction: purchase, subscription change or refund. It selects the frozen commercial parameters.
- `quote.execution.catalogAmountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.execution.nativeDiscountMinor` (integer, optional): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.execution.discount` (object | null, optional): Discount.
- `quote.execution.discount.grantId` (uuid, required): grant ID.
- `quote.execution.discount.couponId` (uuid, required): Coupon UUID in the current App and environment.
- `quote.execution.discount.amountMinor` (integer, required): Amount in the currency's minor unit, such as cents. min: 0 · max: 100000000
- `quote.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"`.
- `quote.execution.discount.applicableProductIds` (array, optional): Merchant-native Product identifiers eligible for this offer in the current App and environment. minItems: 1 · maxItems: 100
- `quote.execution.discount.terms` (object | object, required): Terms.
- `quote.execution.discount.duration` (object | object | object, required): Duration.
- `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.

<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` |
| `CONFLICT` | 409 | The same `requestId` was sent with different input (`reason: IDEMPOTENCY_CONFLICT`). | `resolve_conflict` |
| `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; read the original operation or replay the original ID and input. | `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)
