Manage Customers
Create and manage customers using the Commet SDK and dashboard.
A customer represents the business or person you bill. Each customer can have one active subscription at a time.
Dashboard
Navigate to Customers to view, search, and manage customers. From a customer's detail page you can assign plans, view subscription details, and manage billing.
Create a customer
const { data } = await commet.customers.create({
email: 'billing@acme.com',
id: 'user_123', // optional — your user ID for easy lookup
})
// data.id → 'cus_abc123' (Commet ID)response = commet.customers.create(
email='billing@acme.com',
id='user_123', # optional — your user ID for easy lookup
)
# response.data['id'] → 'cus_abc123' (Commet ID)result, err := client.Customers.Create(ctx, &commet.CreateCustomerParams{
Email: "billing@acme.com",
ID: "user_123", // optional — your user ID for easy lookup
})
// result.Data.ID → "cus_abc123" (Commet ID)CreateCustomerParams params = CreateCustomerParams.builder()
.email("billing@acme.com")
.id("user_123") // optional — your user ID for easy lookup
.build();
ApiResponse<Customer> result = commet.customers().create(params);
// result.getData().getId() → "cus_abc123" (Commet ID)$result = $commet->customers->create(
email: 'billing@acme.com',
id: 'user_123', // optional — your user ID for easy lookup
);
// $result->data['id'] → 'cus_abc123' (Commet ID)curl -X POST https://commet.co/api/customers \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"billingEmail": "billing@acme.com",
"id": "user_123"
}'create is idempotent — if a customer with the same id already exists, it returns the existing record.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Billing email |
id | string | No | Your user ID for easy lookup |
fullName | string | No | Customer name |
address | object | No | Billing address (line1, city, postalCode, country) |
metadata | object | No | Custom key-value pairs |
Get a customer
const { data } = await commet.customers.get('cus_abc123')response = commet.customers.get(customer_id='cus_abc123')result, err := client.Customers.Get(ctx, "cus_abc123")ApiResponse<Customer> result = commet.customers().get("cus_abc123");$result = $commet->customers->get('cus_abc123');curl https://commet.co/api/customers/cus_abc123 \
-H "x-api-key: $COMMET_API_KEY"Update a customer
await commet.customers.update({
customerId: 'cus_abc123',
email: 'new@acme.com',
address: { line1: '123 Main St', city: 'Austin', postalCode: '78701', country: 'US' },
})commet.customers.update(
customer_id='cus_abc123',
email='new@acme.com',
address={'line1': '123 Main St', 'city': 'Austin', 'postal_code': '78701', 'country': 'US'},
)client.Customers.Update(ctx, "cus_abc123", &commet.UpdateCustomerParams{
Email: "new@acme.com",
Address: &commet.Address{
Line1: "123 Main St",
City: "Austin",
PostalCode: "78701",
Country: "US",
},
})UpdateCustomerParams params = UpdateCustomerParams.builder()
.email("new@acme.com")
.address(Address.builder()
.line1("123 Main St")
.city("Austin")
.postalCode("78701")
.country("US")
.build())
.build();
commet.customers().update("cus_abc123", params);$commet->customers->update(
customerId: 'cus_abc123',
email: 'new@acme.com',
address: [
'line1' => '123 Main St',
'city' => 'Austin',
'postalCode' => '78701',
'country' => 'US',
],
);curl -X PUT https://commet.co/api/customers/cus_abc123 \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"billingEmail": "new@acme.com",
"address": {
"line1": "123 Main St",
"city": "Austin",
"postalCode": "78701",
"country": "US"
}
}'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customerId | string | Yes | Commet ID (cus_xxx) or your user ID |
email | string | No | New billing email |
fullName | string | No | Customer name |
timezone | string | No | IANA timezone |
metadata | object | No | Custom key-value pairs |
address | object | No | Billing address (line1, line2, city, state, postalCode, country) |
List customers
Cursor-based pagination. Returns up to 100 customers per page.
const { data, hasMore, nextCursor } = await commet.customers.list({ limit: 25 })response = commet.customers.list(limit=25)
# response.data, response.has_more, response.next_cursorresult, err := client.Customers.List(ctx, &commet.ListCustomersParams{
Limit: 25,
})
// result.Data, result.HasMore, result.NextCursorApiResponse<List<Customer>> result = commet.customers().list(null, null, 25, null);
// result.getData(), result.isHasMore(), result.getNextCursor()$result = $commet->customers->list(limit: 25);
// $result->data, $result->hasMore, $result->nextCursorcurl "https://commet.co/api/customers?limit=25" \
-H "x-api-key: $COMMET_API_KEY"To fetch the next page, pass the nextCursor value.
const nextPage = await commet.customers.list({
limit: 25,
cursor: nextCursor,
})next_page = commet.customers.list(
limit=25,
cursor=next_cursor,
)nextPage, err := client.Customers.List(ctx, &commet.ListCustomersParams{
Limit: 25,
Cursor: nextCursor,
})ApiResponse<List<Customer>> nextPage = commet.customers().list(null, null, 25, nextCursor);$nextPage = $commet->customers->list(
limit: 25,
cursor: $nextCursor,
);curl "https://commet.co/api/customers?limit=25&cursor=$NEXT_CURSOR" \
-H "x-api-key: $COMMET_API_KEY"Archive a customer
await commet.customers.archive('cus_abc123')commet.customers.archive(customer_id='cus_abc123')client.Customers.Archive(ctx, "cus_abc123", "")commet.customers().archive("cus_abc123");$commet->customers->archive('cus_abc123');curl -X PUT https://commet.co/api/customers/cus_abc123 \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'Archived customers cannot be reactivated.
Related
How is this guide?