import { PriceOS } from "priceos";
import type { MyFeatures } from "./priceos.types";
const priceos = new PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);
const session = await priceos.customers.createCheckout("customer_123", {
productKey: "starter_monthly",
successUrl: "https://app.acme.com/billing/success",
customerInfo: {
name: "Alex Johnson",
email: "alex@acme.com",
},
});curl -X POST "https://api.priceos.com/v1/customers/customer_123/checkout" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productKey": "starter_monthly",
"successUrl": "https://app.acme.com/billing/success",
"customerInfo": {
"name": "Alex Johnson",
"email": "alex@acme.com"
}
}'{
"url": "https://checkout.stripe.com/c/pay/cs_test_123"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Checkout
Create a Stripe checkout session for a customer using a Stripe product key, with an optional Stripe price ID override.
import { PriceOS } from "priceos";
import type { MyFeatures } from "./priceos.types";
const priceos = new PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);
const session = await priceos.customers.createCheckout("customer_123", {
productKey: "starter_monthly",
successUrl: "https://app.acme.com/billing/success",
customerInfo: {
name: "Alex Johnson",
email: "alex@acme.com",
},
});curl -X POST "https://api.priceos.com/v1/customers/customer_123/checkout" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productKey": "starter_monthly",
"successUrl": "https://app.acme.com/billing/success",
"customerInfo": {
"name": "Alex Johnson",
"email": "alex@acme.com"
}
}'{
"url": "https://checkout.stripe.com/c/pay/cs_test_123"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Headers
API key from your PriceOS dashboard.
Path Parameters
Internal customer ID.
Body
Product key from your PriceOS dashboard. Must reference a Stripe product (not a custom product).
Optional Stripe price ID. When provided, it must be active and belong to the selected Stripe product.
Optional PriceOS pricing-table release that originated this checkout.
Optional checkout success redirect URL.
Optional checkout cancel redirect URL.
Optional metadata to attach to the Stripe checkout session.
Show child attributes
Show child attributes
Optional customer info used when creating/updating the customer.
Show child attributes
Show child attributes
Optional Stripe Checkout Session params to merge into the request.
Show child attributes
Show child attributes
Response
Checkout session
Stripe checkout URL.