Skip to main content

Booking payments — createPaymentIntentForBooking mutation

Partners can now create a Stripe PaymentIntent for an existing booking and confirm payment in the browser, aligned with the online booking payment flow.

Affected mutation: createPaymentIntentForBooking

Summary

After creating a booking with createBooking, call createPaymentIntentForBooking with the booking id. The response includes:

  • clientSecret — pass to Stripe.js / Payment Element and confirmPayment
  • paymentIntentId — for support and follow-up API calls after confirmation
  • stripeAccountId — the practice connected account id for loadStripe when using Stripe Connect

The booking must belong to the authenticated practice, use a product/booking type with Require payment enabled, have a payable product price (plus tax), and have Stripe connected for the practice.

Pathway (multi-appointment) bookings are not supported in this release; use a single appointment booking.

Example

mutation CreateBookingPaymentIntent($bookingId: ID!) {
createPaymentIntentForBooking(bookingId: $bookingId) {
clientSecret
paymentIntentId
stripeAccountId
error
}
}

Partner flow

  1. createBooking — create the appointment and note the booking id.
  2. createPaymentIntentForBooking — obtain clientSecret and paymentIntentId.
  3. Mount Stripe Payment Element with the client secret and call stripe.confirmPayment in the browser.
  4. After successful confirmation, call the follow-up mutation (when available) to finalise the booking in Semble.

Errors

Typical error responses (HTTP-style statusCode is not exposed on the GraphQL payload; inspect error):

SituationMessage (summary)
Booking not found or wrong practiceBooking with id "…" not found.
Product does not require paymentThis booking type does not require payment.
No price on productProduct does not have a payable price.
Stripe not connectedStripe is not connected for this practice.
Pathway bookingPathway bookings are not supported.
Already paid / pending intentBooking has already been paid / already has a pending payment intent.

Price

The charge amount is the linked product price plus tax. If the product has no payable price, the mutation returns an error.

Permissions

Requires the same createBookings permission as other booking mutations.

See also