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

const autumn = new Autumn()

const result = await autumn.billing.multiAttach({
  customerId: "cus_123",
  plans: [
    {
      planId: "pro_plan",
    },
    {
      planId: "addon_seats",
      featureQuantities: [
        {
          featureId: "seats",
          quantity: 5,
        },
      ],
    },
  ],
});
{
  "customer_id": "cus_123",
  "invoice": {
    "status": "paid",
    "stripe_id": "in_1234",
    "total": 4900,
    "currency": "usd",
    "hosted_invoice_url": "https://invoice.stripe.com/..."
  },
  "payment_url": null
}

Body Parameters

Response

{
  "customer_id": "cus_123",
  "invoice": {
    "status": "paid",
    "stripe_id": "in_1234",
    "total": 4900,
    "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 plans to.

plans
object[]
required

The list of plans to attach to the customer.

Minimum array length: 1
entity_id
string

The ID of the entity to attach the plans to.

free_trial
FreeTrialParams · object

Free trial configuration applied to all plans. Pass an object to set a custom trial, or null to remove any trial.

invoice_mode
object

Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately.

discounts
AttachDiscount · object[]

List of discounts to apply. Each discount can be an Autumn reward ID, Stripe coupon ID, or Stripe promotion code.

success_url
string

URL to redirect to after successful checkout.

checkout_session_params
object

Additional parameters to pass into the creation of the Stripe checkout session.

redirect_mode
enum<string>
default:if_required

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.

Available options:
always,
if_required,
never
new_billing_subscription
boolean

Only applicable when the customer has an existing Stripe subscription. If true, creates a new separate subscription instead of merging into the existing one.

customer_data
CustomerData · object

Customer details to set when creating a customer

entity_data
object

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.