Gestionar Clientes
Crea y gestiona clientes con el SDK de Commet y el dashboard.
Un cliente representa al negocio o persona a quien le cobras. Cada cliente puede tener una suscripción activa a la vez.
Dashboard
Navega a Clientes para ver, buscar y gestionar clientes. Desde la página de detalle de un cliente puedes asignar planes, ver detalles de suscripción y gestionar cobros.
Crear un cliente
const { data } = await commet.customers.create({
email: 'billing@acme.com',
id: 'user_123', // opcional — tu user ID para búsqueda fácil
})
// data.id → 'cus_abc123' (Commet ID)response = commet.customers.create(
email='billing@acme.com',
id='user_123', # opcional — tu user ID para búsqueda fácil
)
# response.data['id'] → 'cus_abc123' (Commet ID)result, err := client.Customers.Create(ctx, &commet.CreateCustomerParams{
Email: "billing@acme.com",
ID: "user_123", // opcional — tu user ID para búsqueda fácil
})
// result.Data.ID → "cus_abc123" (Commet ID)CreateCustomerParams params = CreateCustomerParams.builder()
.email("billing@acme.com")
.id("user_123") // opcional — tu user ID para búsqueda fácil
.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', // opcional — tu user ID para búsqueda fácil
);
// $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 es idempotente — si ya existe un cliente con el mismo id, devuelve el registro existente.
Parámetros
| Parámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
email | string | Sí | Email de cobro |
id | string | No | Tu user ID para búsqueda fácil |
fullName | string | No | Nombre del cliente |
address | object | No | Dirección de cobro (line1, city, postalCode, country) |
metadata | object | No | Pares clave-valor custom |
Obtener un cliente
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"Actualizar un cliente
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"
}
}'Parámetros
| Parámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
customerId | string | Sí | ID de Commet (cus_xxx) o tu user ID |
email | string | No | Nuevo email de cobro |
fullName | string | No | Nombre del cliente |
timezone | string | No | Zona horaria IANA |
metadata | object | No | Pares clave-valor custom |
address | object | No | Dirección de cobro (line1, line2, city, state, postalCode, country) |
Listar clientes
Paginación basada en cursor. Devuelve hasta 100 clientes por página.
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"Para obtener la siguiente página, pasa el valor de nextCursor.
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"Relacionado
¿Cómo está esta guía?