cus_…) belongs to one merchant and one mode. The customer a
payment lands on holds that payment’s saved card, subscription, and history.
Checkout buyers pay as guests unless a customer is needed. A guest payment has
no customer; the buyer’s details stay on the checkout session. Your
integration creates customers for buyers it knows, and checkout creates one
when a subscription needs it or when you ask it to.
Customers and guests
Checkout treats the email a buyer types as contact details, not as proof of
identity. It never attaches a payment to an existing customer because the
buyer typed that customer’s email.
How checkout decides
Subscription sessions always require an email, so every subscription signup has a customer. Withcustomer_creation: always, a payment where the buyer
enters no email also completes as a guest.
Link checkout to a customer you know
When the buyer is signed in to your site, pass their customer ID ascustomer when you create the session. The payment, any saved card, and any
subscription attach to that customer. Checkout shows the customer’s email,
and the buyer can’t change it.
- The customer must belong to the same merchant and mode as the session and
must be active. A deleted customer, or one from another merchant or mode,
returns
404with codeCUSTOMER_NOT_FOUND. - To show an email for a buyer without a customer record, pass
customer_emailinstead. Checkout shows it, the buyer can’t change it, and the payment uses it. Pass eithercustomerorcustomer_email; a session with both returns400. - Create the customer with
POST /v1/customersthe first time a buyer signs up, store its ID on your user record, and pass that ID on every session for the same buyer.
Read a guest’s details
A completed guest session hascustomer set to null. The buyer’s email,
name, phone, and billing address are in customer_details, and a shipping
address, when the session collects one, is in shipping_details. Read them
from the checkout.session.completed event, whose data.object is the
session, or retrieve the session after the buyer returns to your
success_url.
TypeScript
Create a customer for every buyer
Setcustomer_creation to always when you want a customer for each buyer
who enters an email. Set it on a payment link to apply it to every checkout
from that link.
In the dashboard, select Create a customer for every buyer under
Payment options when you create or edit a one-time payment link.
- The completed session’s
customerholds the customer checkout created, andcustomer.createdfires withdata.object.creation_sourceset tocheckout. - A session creates at most one customer. When the buyer submits the same
session again, for example after a declined card, the session keeps that
customer and updates it with the details from the new submission, and
customer.updatedfires when anything changed. A customer you pass ascustomeris never changed. customer_creationapplies to payment sessions and one-time payment links. Subscription sessions always create a customer, and setting the field on them returns400.
Save cards
A saved card belongs to a customer. When you setpayment_intent_data.setup_future_usage, checkout offers the buyer the option
to save their card only when the session has a customer or
customer_creation: always. A guest’s card is not saved.
On a one-time payment link in the dashboard, selecting Save card for future
payments also selects Create a customer for every buyer, so each saved
card has a customer to belong to.
Keep your records in sync
- Store customers by
id. One email can belong to several customers at the same merchant: one you created and one for each session that created a customer for that buyer. - Find every customer for an email with the list endpoint.
searchmatches part of a customer’s email, name, or ID, so keep the results whoseemailequals the address, ignoring case. Results are paginated: iterate withfor awaitin the SDK, or passnext_cursorasstarting_afteruntilhas_moreisfalse.
- Reuse the customer behind a
409. WhenPOST /v1/customersreturnsCUSTOMER_EMAIL_ALREADY_EXISTS, search for the email and use the customer you created earlier. Only customers you create count toward the409.
Guests in the dashboard
The Guests tab on the Customers page groups guest payments by email, with each guest’s payment count, spend, and first and last payment. Open a guest to see their payments. Guest payments in the payments list show the buyer’s email.Returning-customer counts
The dashboard counts paying buyers by email within the selected date range, guests included. A buyer counts once, even if they pay through several checkouts. They count as new if their first payment falls within that range, or as returning if their first payment was before it.Connected accounts
On a Connect platform, each connected account has its own customers and guests, and every rule on this page applies per account. A checkout session you create for a connected account creates any customer under that account. Store the merchant ID next to each customer ID, and pass acustomer that belongs to the same connected account.
What’s next
Manage customers
Create, update, and list customers, and attach payment methods.
Hosted checkout
Create a session and send the buyer to the hosted page.

