Skip to main content
POST
/
v1
/
billing.update
Typescript (SDK)
import { Autumn } from 'autumn-js'

const autumn = new Autumn()

const result = await autumn.billing.update({
  customerId: "cus_123",
  planId: "pro_plan",
  featureQuantities: [
    {
      featureId: "seats",
      quantity: 10,
    },
  ],
});
{
  "customer_id": "cus_123",
  "invoice": {
    "status": "paid",
    "stripe_id": "in_1234",
    "total": 1500,
    "currency": "usd",
    "hosted_invoice_url": "https://invoice.stripe.com/..."
  },
  "payment_url": null
}
The update endpoint modifies an existing subscription. Use this to change prepaid quantities, cancel subscriptions, or modify plan configuration. For subscribing to a new plan, use attach instead.

Common Use Cases

const response = await autumn.billing.update({
  customerId: "cus_123",
  planId: "pro_plan",
  featureQuantities: [{ featureId: "seats", quantity: 10 }]
});

Body Parameters

Response

{
  "customer_id": "cus_123",
  "invoice": {
    "status": "paid",
    "stripe_id": "in_1234",
    "total": 1500,
    "currency": "usd",
    "hosted_invoice_url": "https://invoice.stripe.com/..."
  },
  "payment_url": null
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-api-version
string
default:2.1
required

Body

application/json
customer_id
string
required

The ID of the customer to attach the plan to.

plan_id
string
required

The ID of the plan.

entity_id
string

The ID of the entity to attach the plan to.

feature_quantities
FeatureQuantity · object[]

If this plan contains prepaid features, use this field to specify the quantity of each prepaid feature. This quantity includes the included amount and billing units defined when setting up the plan.

version
number

The version of the plan to attach.

customize
object

Customize the plan to attach. Can override the price, items, free trial, or a combination.

invoice_mode
object

Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.

proration_behavior
enum<string>

How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.

Available options:
prorate_immediately,
none
cancel_action
enum<string>

Action to perform for cancellation. 'cancel_immediately' cancels now with prorated refund, 'cancel_end_of_cycle' cancels at period end, 'uncancel' reverses a pending cancellation.

Available options:
cancel_immediately,
cancel_end_of_cycle,
uncancel

Response

200 - application/json

OK

customer_id
string
required

The ID of the customer.

payment_url
string | null
required

URL to redirect the customer to complete payment. Null if no payment action is required.

entity_id
string

The ID of the entity, if the plan was attached to an entity.

invoice
object

Invoice details if an invoice was created. Only present when a charge was made.

required_action
object

Details about any action required to complete the payment. Present when the payment could not be processed automatically.