Skip to content
Coursey CreativeSign in

POST /customer

/api/store/[slug]/customer

Creates the authenticated customer's own storefront record (with a Stripe customer on the business's connected account), or returns their existing one, optionally attaching metadata.

Customer bearer token requiredHow authentication works

Path parameters

slugstringrequired

Business store slug (non-empty string); 404 if no business matches.

Body parameters

namestringoptional

Customer display name passed to Stripe.

metadataobjectoptional

Flat string-to-string map (z.record(z.string(), z.string())) attached to the Stripe customer; merged with ccp_business_id when updating an existing customer.

Responses

200

The request succeeded.

201

The resource was created.

400

A field failed validation. The response names the fields that failed, not just the first.

404

No such store, or no such record inside it.

What comes back

201 with created: true when a new record is created; 200 with created: false when the customer already exists. Body: { customer: { id, businessId, stripeCustomerId, email, createdAt, updatedAt }, created: boolean }. The request body is optional - both fields are optional, so an empty body is valid. Errors: { error, details? } with 400 (validation or business has no Stripe account) or 404 (business not found).