Skip to main content
POST
/
workspaces
/
{workspaceId}
/
billing-accounts
/
{billingAccountId}
/
invoices
/
preview
Preview an invoice
curl --request POST \
  --url https://api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/invoices/preview \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "subscription_id": "sub_a1b2c3d4e5f6g7h8",
  "items": [
    {
      "product_type": "locations",
      "quantity": 15,
      "interval": "month"
    }
  ],
  "cancel_subscription": false
}'
{
  "id": "in_1Kb...",
  "customer_id": "cus_...",
  "status": "paid",
  "amount_due": 999,
  "amount_paid": 999,
  "currency": "usd",
  "created_at": "2025-10-29T00:40:06.000000Z",
  "subtotal": 1099,
  "total": 999,
  "tax": 0,
  "discount_amount": 100,
  "discount_names": [
    "10% Off Coupon"
  ],
  "lines": [
    {
      "id": "il_1Kb...",
      "description": "10 ร— Locations",
      "amount": 1000,
      "currency": "usd",
      "quantity": 10,
      "price_id": "price_...",
      "unit_amount": 100,
      "product_name": "Locations"
    }
  ],
  "due_date": null,
  "hosted_invoice_url": "https://invoice.stripe.com/...",
  "invoice_pdf": "https://pay.stripe.com/...",
  "number": "AB123-001"
}

Authorizations

Authorization
string
header
required

Enter your JWT in the format: Bearer {token}

Path Parameters

workspaceId
string
required

The ID of the workspace.

Example:

"ws_a1b2c3d4e5f6g7h8"

billingAccountId
string
required

The ID of the billing account, which corresponds to a Stripe Customer ID (cus_...).

Example:

"cus_a1b2c3d4e5f6g7h8"

Body

application/json
subscription_id
string

The ID of an existing subscription to preview changes for. If omitted, previews a new subscription.

Example:

"sub_a1b2c3d4e5f6g7h8"

items
object[]

A list of products and their new quantities to preview. To remove a product, set its quantity to 0 or omit it.

cancel_subscription
boolean

Set to true to preview the invoice for canceling the subscription at the end of the current period.

Example:

false

Response

The previewed invoice object.

id
string
Example:

"in_1Kb..."

customer_id
string
Example:

"cus_..."

status
string
Example:

"paid"

amount_due
integer

Final amount due in the smallest currency unit (e.g., cents).

Example:

999

amount_paid
integer

The amount paid on this invoice in the smallest currency unit.

Example:

999

currency
string
Example:

"usd"

created_at
string<date-time>
Example:

"2025-10-29T00:40:06.000000Z"

subtotal
integer

Total of all line items before discounts and taxes.

Example:

1099

total
integer

Total after discounts and taxes.

Example:

999

tax
integer | null

The amount of tax on this invoice.

Example:

0

discount_amount
integer | null

The total discount amount applied to this invoice.

Example:

100

discount_names
string[]
Example:
["10% Off Coupon"]
lines
object[]
due_date
string<date-time> | null
Example:

null

hosted_invoice_url
string<uri> | null
Example:

"https://invoice.stripe.com/..."

invoice_pdf
string<uri> | null
Example:

"https://pay.stripe.com/..."

number
string | null
Example:

"AB123-001"