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

const response = await autumn.checkout({
customer_id: 'user_123',
product_id: 'pro'
})
{
  "url": "https://checkout.stripe.com/c/pay/cs_test_b1aiNVtSaxIymaUwIgzyDqxsX9TryoFzm8uS0nhncxN6TXFKCydjB9waEk#fid2cGd2ZndsdXFsamtQa2x0cGBrYHZ2QGtkZ2lgYSc%2FY2RpdmApJ2R1bE5gfCc%2FJ3VuWnFgdnFaMDRVajE2YUJNal9QRHVdXWFUVU90T0xNN3NUSXRdXWNqbEw9RGd2QlF9TkhdSU9VU29uSFFRSzJzVUJoVzFxalFhZzw0QmBUUXI9ckZDbGNEQ39nM1N9aGM1NWN2cTN0QWtrJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ2hwaXFsWmxxYGgnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl",
  "customer_id": "b",
  "lines": [],
  "product": {
    "id": "pro",
    "name": "Pro",
    "group": null,
    "env": "sandbox",
    "is_add_on": false,
    "is_default": false,
    "version": 2,
    "created_at": 1753805339212,
    "items": [
      {
        "type": "price",
        "feature_id": null,
        "feature": null,
        "interval": "month",
        "price": 20
      },
      {
        "type": "priced_feature",
        "feature_id": "messages",
        "feature_type": "single_use",
        "feature": {
          "id": "messages",
          "name": "Messages",
          "type": "single_use",
          "display": {
            "singular": "message",
            "plural": "messages"
          }
        },
        "included_usage": 100,
        "interval": "month",
        "price": 0.1,
        "usage_model": "pay_per_use",
        "billing_units": 1,
        "reset_usage_when_enabled": false,
        "entity_feature_id": null
      }
    ],
    "free_trial": null,
    "base_variant_id": null,
    "scenario": "new",
    "properties": {
      "is_free": false,
      "is_one_off": false,
      "interval_group": "month",
      "has_trial": false,
      "updateable": false
    }
  }
}
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.

customer_data
object

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

checkout_session_params
object

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

Response

200 - application/json

The response is of type object.