POST /customer
/api/store/[slug]/customerCreates 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.
Path parameters
slugstringrequiredBusiness store slug (non-empty string); 404 if no business matches.
Body parameters
namestringoptionalCustomer display name passed to Stripe.
metadataobjectoptionalFlat 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
The request succeeded.
The resource was created.
A field failed validation. The response names the fields that failed, not just the first.
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).