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
}
}
}Core
Checkout
Returns a Stripe Checkout URL for the customer to make a payment, or returns payment confirmation information.
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
Use your Autumn Secret Key as the Bearer token.
Body
application/json
Your unique identifier for the customer
Product ID, set when creating the product in the Autumn dashboard
List of product IDs to attach to the customer in the same subscription or transaction
URL to redirect to after the purchase is successful
Pass in quantities for prepaid features.
Show child attributes
Show child attributes
An Autumn promo_code or reward_id to apply at checkout.
Additional customer properties. These will be used if the customer's properties are not already set.
Show child attributes
Show child attributes
Additional parameters to pass onto Stripe when creating the checkout session.
Response
200 - application/json
The response is of type object.
⌘I

