Skip to main content
POST
/
attach
import { Autumn as autumn } from 'autumn-js'

const response = await autumn.attach({
customer_id: 'user_123',
product_id: 'pro'
})
{
  "customer_id": "a",
  "product_ids": [
    "pro"
  ],
  "code": "updated_product_successfully",
  "message": "Successfully updated product"
}
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

Use your Autumn Secret Key as the Bearer token.

Body

application/json
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

options
object[]

Pass in quantities for prepaid features.

reward
string

An Autumn promo_code or reward_id to apply at checkout.

entity_id
string

If using entities, the entity to attach the product to.

force_checkout
boolean
default:false

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

customer_data
object

Additional customer properties. These will be used if the customer's properties are not already set.

metadata
object

Additional metadata to pass onto Stripe.

checkout_session_params
object

Additional parameters to pass onto Stripe when creating the checkout session.

Response

200 - application/json

Customer 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