--- title: "Update Subscription" openapi: "openapi POST /v1/billing.update" --- import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; 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](/api-reference/billing/billingAttach) instead. ### Common Use Cases ```typescript Update prepaid quantity const response = await autumn.billing.update({ customerId: "cus_123", planId: "pro_plan", featureQuantities: [{ featureId: "seats", quantity: 10 }] }); ``` ```typescript Cancel at end of cycle const response = await autumn.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "cancel_end_of_cycle" }); ``` ```typescript Uncancel subscription const response = await autumn.billing.update({ customerId: "cus_123", planId: "pro_plan", cancelAction: "uncancel" }); ``` ### Body Parameters 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. 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. The version of the plan to attach. Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely. Customize the plan to attach. Can either override the price of the plan, the items in the plan, or both. 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. When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method. If true, enables the plan immediately even though the invoice is not paid yet. If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review. How to handle billing when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'next_cycle_only' skips creating any charges and applies the change at the next billing cycle. 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. ### Response The ID of the customer. 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. The status of the invoice (e.g., 'paid', 'open', 'draft'). The Stripe invoice ID. The total amount of the invoice in cents. The three-letter ISO currency code (e.g., 'usd'). URL to the hosted invoice page where the customer can view and pay the invoice. URL to redirect the customer to complete payment. Null if no payment action is required. Details about any action required to complete the payment. Present when the payment could not be processed automatically. The type of action required to complete the payment. A human-readable explanation of why this action is required. ```json 200 { "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 } ```