Skip to main content
If you have custom products that you need to assign to customers that don’t exist in Stripe, you’ll need to create those customers manually using our API.
There is no need to create customers that already exist in Stripe customers, but you will need to link them with your own internal ID.

Create a customer

You can create a customer with just a customer ID.
const customer = await priceos.customers.create({
  customerId: "customer_123", // Your own interal customer/user ID
});
Customers will also be created anytime you try to evaluate feature access or track usage with a new customer ID.

Create a customer with name and email

const customer = await priceos.customers.create({
  customerId: "customer_123",
  name: "Alex Johnson",
  email: "alex@acme.com",
});
You can update the customer at any time using update customer.

Create a customer with usage start date

The usageStartedAt is only needed if you have a limit feature that resets based on billing period and you use PriceOS to track usage for it. In that case, the usageStartedAt is the anchor we use to determine when usage will be reset for this user.
const customer = await priceos.customers.create({
  customerId: "customer_123",
  usageStartedAt: Date.parse("2024-01-01T00:00:00.000Z"),
});
If no usageStartedAt is provided, we’ll just use the date the customer was created in our system.

Create a customer and assign custom products

const customer = await priceos.customers.create({
  customerId: "customer_123",
  customProductKeys: ["custom_basic", "custom_addon"],
});
To remove custom products update the customer with the remaining customProductKeys (or an empty list).
Stripe products and default products cannot be manually assigned.