Skip to content

Stripe login and payment flow

This guide describes how a logged-in end user completes a Stripe purchase when your client uses the Vimond Default Payment Provider. It complements the platform Payment guide (product groups and orders on the Vimond REST API) by focusing on the payment-provider service and Stripe.js. For the Vipps redirect-based flow, see Vipps login and payment flow.

Typical components:

RoleResponsibility
Client appLogin (OIDC/JWT), checkout UI, Stripe Elements, confirmCardPayment
Default Payment ProviderCustomer/payment-method APIs, checkout, webhook verification, agreements and charges
StripePayment methods, subscriptions, payment intents, webhooks

API contracts: Default Payment Provider — Stripe Checkout, Stripe Webhooks, Customer · compact OpenAPI index

Prerequisites: End-user authentication. For subscription concepts after purchase, see SVOD.

Flow diagram 1
  1. User logs in in the web app and gets a JWT.
  2. Web app fetches saved payment methods from backend.
  3. User checks out with Stripe card flow.
  4. Backend creates Stripe subscription/payment intent and returns clientSecret.
  5. Frontend confirms payment with Stripe (confirmCardPayment).
  6. Stripe sends webhooks to backend.
  7. Backend updates agreements, charges, and entitlements.
Sequence diagram 2

Note: The client confirms payment for UX; webhooks finalize agreement and charge records. Do not treat a successful confirmCardPayment alone as subscription activation.

Client confirms payment; durable state is driven by webhooks.

Sequence diagram 3
Sequence diagram 4
State diagram 5
Stripe eventHandlerMain effect
customer.subscription.createdStripeSubscriptionCreatedHandlerDraft agreement
invoice_payment.paidStripeInvoicePaymentPaidHandlerPersist charge; redeem voucher on first charge
customer.subscription.updatedStripeSubscriptionUpdatedHandlerRoute by status strategy
invoice.paidStripeInvoicePaidHandlerSVOD receipt
customer.subscription.deletedStripeSubscriptionDeletedHandlerEnd agreement, release voucher if needed

StripeEventType also lists charge, payment_intent, checkout.session, and invoice failure events — some are observability-only or TVOD-specific.

Webhook entry points:

  • POST /api/v1/webhook/stripe/ — shared tenant mode (preferred; resolves tenancy from Stripe account)
  • POST /api/v1/webhook/stripe/{organization} — organization-scoped variant

All Stripe webhooks require a valid Stripe-Signature header.

EndpointPurpose
POST /api/v1/pay/stripe/checkoutCreate SVOD subscription; returns clientSecret
POST /api/v1/pay/stripe/tvodCreate TVOD payment intent
GET /api/v1/customer/paymentMethodsList saved payment methods
PUT /api/v1/customerUpdate customer / default payment method
POST /api/v1/webhook/stripe/Stripe webhook receiver
  • Fetch methods: getCustomerPaymentMethods(...)
  • Checkout calls: createStripeSubscription(...), createStripeTVOD(...)
  • Payment confirmation: stripe.confirmCardPayment(...)
  • Backend is the source of truth for final state via Stripe webhooks.
  • Frontend handles immediate UX, but webhook processing finalizes durable agreement and charge state.
  • Payment — product groups, orders, and REST API purchase flow
  • SVOD — viewing and managing subscriptions after purchase
  • TVOD — transactional purchases
  • Auto-renew subscriptions — renewal behaviour