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

const autumn = new Autumn()

const result = await autumn.billing.setupPayment({
  customerId: "cus_123",
  successUrl: "https://example.com/account/billing",
});
{
  "customer_id": "cus_123",
  "url": "https://checkout.stripe.com/..."
}

Body Parameters

Response

{
  "customer_id": "cus_123",
  "url": "https://checkout.stripe.com/..."
}

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.

entity_id
string

The ID of the entity to attach the plan to.

plan_id
string

If specified, the plan will be attached to the customer after setup.

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.

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
subscription_id
string

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.

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.

custom_line_items
object[]

Custom line items that override the auto-generated proration invoice. Only valid for immediate plan changes (eg. upgrades or one off plans).

processor_subscription_id
string

The processor subscription ID to link. Use this to attach an existing Stripe subscription instead of creating a new one.

carry_over_balances
object

Whether to carry over balances from the previous plan.

carry_over_usages
object

Whether to carry over usages from the previous plan.

Response

200 - application/json

OK

customer_id
string
required

The ID of the customer

url
string
required

URL to redirect the customer to setup their payment.

entity_id
string

The ID of the entity the plan (if specified) will be attached to after setup.