Post-Payment Customer Linking
This page documents the PrimeCal flow that runs after a successful public booking payment. Use it when you need to understand:
- how PrimeCal resolves or creates the customer account
- how the reservation is linked idempotently
- how the confirmation page chooses its calendar destination
- how future booking forms prefill safe customer fields
Customer Account Resolution
After a successful payment, PrimeCal automatically:
- normalizes the customer email and contact fields
- performs a case-insensitive user lookup
- safely enriches an existing user only when fields are missing
- creates a customer account when the email is unknown
- creates a short-lived password-setup token (stored as a hash only)
The reservation is linked to the resolved customer account idempotently. Audit records are created for:
- auto-created customers
- safe profile enrichments
- reservation-to-user linking
- skipped or conflicting relink attempts
Public Endpoints And Response Contract
Relevant endpoints:
POST /api/public/booking/organisations/:slug/reserveGET /api/public/booking/organisations/:slug/checkout-statusPOST /api/payments/stripe/webhook
The checkout-status response carries the fields the client needs after
payment:
{
"reservationId": 901,
"status": "confirmed",
"paymentStatus": "succeeded",
"requiresPayment": true,
"canRetryPayment": false,
"confirmationMessage": "Your booking is confirmed.",
"customerAccount": {
"status": "created",
"requiresPasswordSetup": true,
"profile": {
"name": "May B. Late",
"email": "may@example.com",
"phone": "+15550001015"
}
},
"navigation": {
"organisationSlug": "primecal-spa",
"calendarPageUrl": "/book/primecal-spa"
}
}
Notes:
customerAccount.profileis intentionally lean and contains only safe prefill fields.navigation.calendarPageUrlis the backend-provided destination for public flows that should not hard-code a route.- authenticated customers can still be sent to
/app/calendaras the canonical signed-in workspace route.
Confirmation-Page Behavior
After the public booking return from Stripe:
- the client polls
checkout-status - the payment-return screen renders when the reservation is confirmed
- the screen shows:
- Go to my calendar
- Book another time
- the primary action resolves as:
/app/calendarfor an authenticated customer sessionnavigation.calendarPageUrlfor a public or auto-created customer flow
Customer-Profile Prefills
The client merges safe customer data from:
- the authenticated session
checkout-status.customerAccount.profile- a local customer-profile cache used for later public booking visits
Only these fields are reused:
nameemailphone
The public form still allows the user to override every value before submit.
Password Setup And Onboarding Messages
The backend prepares a password-setup token after auto-creating a customer account, but delivery still needs to be triggered. Typical options are:
- a built-in onboarding email
- a notification or automation message
- a support or CRM-triggered onboarding flow
Keep these requirements in mind:
- never send plain-text passwords
- keep the password-setup link short-lived
- explain clearly that the account was created after a paid booking
- explain that the link lets the customer finish account activation safely
Security Notes
- PrimeCal does not store raw card data.
- PrimeCal does not expose Stripe secrets, webhook secrets, or internal payment metadata in the frontend.
- Payment confirmation remains webhook-driven.
- Customer-profile reuse is limited to safe booking-contact fields.
- Auto-created customer access stays scoped to the intended booking/calendar path instead of broad organisation membership.