Get a customer
You can get a customer using the GET customer endpoint.
const customer = await priceos.customers.get("customer_123");
curl -X GET "https://api.priceos.com/v1/customers/customer_123" \
-H "x-api-key: PRICEOS_API_KEY"
The customer object will have feature access info too.
Update a customer
You can use the PUT customer endpoint to update customer info, add/remove custom products, and more.
Update Email/Name
Add Custom Products
Remove Custom Products
const customer = await priceos.customers.update({
customerId: "customer_123",
name: "Alex Johnson",
email: "alex@acme.com",
});
curl -X PUT "https://api.priceos.com/v1/customers/customer_123" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Alex Johnson",
"email": "alex@acme.com"
}'
If the customer exists in Stripe, then any updates to name/email will be overwritten if updated again in Stripe.
Use customProductKeys in customers.update to set custom product assignments.const customer = await priceos.customers.update({
customerId: "customer_123",
customProductKeys: ["custom_basic", "custom_addon"],
});
curl -X PUT "https://api.priceos.com/v1/customers/customer_123" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customProductKeys": ["custom_basic", "custom_addon"]
}'
To remove one or more custom products, call update with the remaining customProductKeys.
To remove all custom products, send an empty array.const customer = await priceos.customers.update({
customerId: "customer_123",
customProductKeys: [],
});
curl -X PUT "https://api.priceos.com/v1/customers/customer_123" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customProductKeys": []
}'
This only applies to custom products. Stripe product access is removed in Stripe (cancel/update subscription).
Delete a customer
You can delete customers using the DELETE customer endpoint.
const result = await priceos.customers.delete("customer_123");
curl -X DELETE "https://api.priceos.com/v1/customers/customer_123" \
-H "x-api-key: PRICEOS_API_KEY"
If a customer exists in Stripe, you will need to delete the customer in Stripe - not PriceOS.