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,
},
],
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.billing.update(
customer_id="cus_123",
plan_id="pro_plan",
feature_quantities=[
{
"feature_id": "seats",
"quantity": 10,
},
],
redirect_mode="if_required",
)curl --request POST \
--url https://api.useautumn.com/v1/billing.update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"customer_id": "cus_123",
"plan_id": "pro_plan",
"feature_quantities": [
{
"feature_id": "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
}
Update Subscription
Updates an existing subscription. Use to modify feature quantities, cancel, or change plan configuration.
Use this endpoint to update prepaid quantities, cancel a subscription (immediately or at end of cycle), or modify subscription settings.
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,
},
],
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.billing.update(
customer_id="cus_123",
plan_id="pro_plan",
feature_quantities=[
{
"feature_id": "seats",
"quantity": 10,
},
],
redirect_mode="if_required",
)curl --request POST \
--url https://api.useautumn.com/v1/billing.update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"customer_id": "cus_123",
"plan_id": "pro_plan",
"feature_quantities": [
{
"feature_id": "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
}
Common Use Cases
const response = await autumn.billing.update({
customerId: "cus_123",
planId: "pro_plan",
featureQuantities: [{ featureId: "seats", quantity: 10 }]
});
const response = await autumn.billing.update({
customerId: "cus_123",
planId: "pro_plan",
cancelAction: "cancel_end_of_cycle"
});
const response = await autumn.billing.update({
customerId: "cus_123",
planId: "pro_plan",
cancelAction: "uncancel"
});
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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
The ID of the customer to attach the plan to.
The ID of the entity to attach the plan to.
The ID of the plan to update. Optional if subscription_id is provided, or if the customer has only one product.
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.
Show child attributes
Show child attributes
The version of the plan to attach.
Free trial for this plan. A shorthand for customize.free_trial, which takes precedence when both are given.
Show child attributes
Show child attributes
Customize the plan to attach. Can override the price, items, licenses, free trial, or a combination.
Show child attributes
Show child attributes
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.
Show child attributes
Show child attributes
How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.
prorate_immediately, none Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
always, if_required, never A unique ID to identify this subscription. Can be used to target specific subscriptions in update operations when a customer has multiple products with the same plan.
List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.
Show child attributes
Show child attributes
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.
cancel_immediately, cancel_end_of_cycle, uncancel Reset the billing cycle immediately with 'now', or schedule a reset at a future Unix timestamp in milliseconds.
If true, the subscription is updated internally without applying billing changes in Stripe.
Controls how the last payment is refunded on immediate cancellation. 'prorated' refunds the unused portion, 'full' refunds the entire last payment.
prorated, full Additional parameters to pass into the Stripe subscription update or cancel call.
Show child attributes
Show child attributes
Controls whether balances should be recalculated during the subscription update.
Show child attributes
Show child attributes
Whether to carry over usages from the previous plan.
Show child attributes
Show child attributes
Total seat quantities (inclusive of the license's included count) per license plan offered by this plan. Licenses not listed keep their current paid quantity.
Show child attributes
Show child attributes
Response
OK
The ID of the customer.
URL to redirect the customer to complete payment. Null if no payment action is required.
The ID of the entity, if the plan was attached to an entity.
Invoice details if an invoice was created. Only present when a charge was made.
Show child attributes
Show child attributes
Details about any action required to complete the payment. Present when the payment could not be processed automatically.
Show child attributes
Show child attributes