Node.js
import { PriceOS } from "priceos";
import type { MyFeatures } from "./priceos.types";
const priceos = new PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);
const customer = await priceos.customers.create({
customerId: "customer_123",
email: "alex@acme.com",
name: "Alex Johnson",
});curl -X POST "https://api.priceos.com/v1/customers" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer_123",
"email": "alex@acme.com",
"name": "Alex Johnson"
}'{
"customerId": "customer_123",
"stripeCustomerId": "cus_abc123",
"hasPaymentMethod": true,
"name": "Ada Lovelace",
"email": "ada@example.com",
"created": 1735689600000,
"usageStartedAt": 1735689600000,
"enviroment": "test",
"products": [
{
"id": "prod_123",
"key": "starter",
"name": "Starter",
"type": "stripe",
"isDefault": false,
"status": "active",
"version": 1,
"metadata": {
"tier": "starter"
},
"canceledAt": null,
"startedAt": 1735689600000,
"currentPeriodStart": 1735689600000,
"currentPeriodEnd": 1738368000000,
"prices": [
{
"stripePriceId": "price_123",
"quantity": 1,
"currency": "usd",
"unitAmount": 2000,
"recurringInterval": "month",
"isActive": true,
"isDefault": true,
"recurringIntervalCount": 1
}
]
}
],
"featureAccess": {
"api_calls": {
"hasAccess": true,
"type": "limit",
"limit": 1000,
"isUnlimited": false,
"usage": {
"used": 120,
"remaining": 880,
"bonusRemaining": 25,
"hasReachedLimit": false,
"bonusUsed": 5,
"nextReset": 1738368000000,
"lastReset": 1735689600000
}
},
"team_seats": {
"hasAccess": true,
"type": "boolean"
}
},
"bonuses": [
{
"bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
"featureKey": "api_calls",
"amount": 50,
"remainingAmount": 50,
"expiresAt": 1738368000000,
"reason": "Support credit",
"metadata": {
"source": "support"
},
"createdAt": 1735689600000,
"updatedAt": 1735689600000
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Customers
Create Customer
Create a customer record.
POST
/
v1
/
customers
Node.js
import { PriceOS } from "priceos";
import type { MyFeatures } from "./priceos.types";
const priceos = new PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);
const customer = await priceos.customers.create({
customerId: "customer_123",
email: "alex@acme.com",
name: "Alex Johnson",
});curl -X POST "https://api.priceos.com/v1/customers" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer_123",
"email": "alex@acme.com",
"name": "Alex Johnson"
}'{
"customerId": "customer_123",
"stripeCustomerId": "cus_abc123",
"hasPaymentMethod": true,
"name": "Ada Lovelace",
"email": "ada@example.com",
"created": 1735689600000,
"usageStartedAt": 1735689600000,
"enviroment": "test",
"products": [
{
"id": "prod_123",
"key": "starter",
"name": "Starter",
"type": "stripe",
"isDefault": false,
"status": "active",
"version": 1,
"metadata": {
"tier": "starter"
},
"canceledAt": null,
"startedAt": 1735689600000,
"currentPeriodStart": 1735689600000,
"currentPeriodEnd": 1738368000000,
"prices": [
{
"stripePriceId": "price_123",
"quantity": 1,
"currency": "usd",
"unitAmount": 2000,
"recurringInterval": "month",
"isActive": true,
"isDefault": true,
"recurringIntervalCount": 1
}
]
}
],
"featureAccess": {
"api_calls": {
"hasAccess": true,
"type": "limit",
"limit": 1000,
"isUnlimited": false,
"usage": {
"used": 120,
"remaining": 880,
"bonusRemaining": 25,
"hasReachedLimit": false,
"bonusUsed": 5,
"nextReset": 1738368000000,
"lastReset": 1735689600000
}
},
"team_seats": {
"hasAccess": true,
"type": "boolean"
}
},
"bonuses": [
{
"bonusId": "9e9be7e5-55d2-4b44-93af-c3687f4b8af5",
"featureKey": "api_calls",
"amount": 50,
"remainingAmount": 50,
"expiresAt": 1738368000000,
"reason": "Support credit",
"metadata": {
"source": "support"
},
"createdAt": 1735689600000,
"updatedAt": 1735689600000
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Body
application/json
Response
Customer created
Customer info.