curl --request POST \
  --url https://api.useautumn.com/v1/attach \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "customer_id": "john-123",
  "product_id": "pro-tier"
}'
{
  "checkout_url": "https://checkout.stripe.com/c/pay/<hash>"
}

If the customer_id you send doesn’t already exist, Autumn will automatically create a new customer. You can optionally set the properties of this new customer through the customer_data field.

Authorizations

Authorization
string
header
required

You can use your Secret or Publishable key for this endpoint. Using your Publishable Key will always return a checkout_url. Using your Secret Key allows you to handle payments automatically (eg, for plan upgrades).

Body

application/json
Customer and product to attach
customer_id
string
required

Your unique identifier for the customer

product_id
string
required

Product ID, set when creating the product in the Autumn dashboard

product_ids
string[]

List of product IDs to attach to the customer in the same subscription or transaction

success_url
string

URL to redirect to after the purchase is successful

force_checkout
boolean
default:false

Always return a Stripe Checkout URL, even if the customer's card is already on file.

options
object[]

An array of billing options for the product. Required for some pricing types.

customer_data
object

Properties to create a new customer. If a customer with the provided customer_id already exists, this object is ignored. Alternatively, use the /customers endpoint.

Response

200 - application/json
Device attached
checkout_url
string

URL to the Stripe checkout page. Only present if payment is required.

success
boolean

Indicates if the product change was successful. Only present if payment is not required.

message
string

Description of the action taken