feat(payments): add payment intent and Stripe Checkout endpoints - #375
Merged
devIKargi merged 1 commit intoAug 19, 2026
Merged
Conversation
…llAIverse#371) The payments module handled customers, subscriptions, invoices and webhooks but had no way to start an ad-hoc charge or a hosted checkout flow. Add: - POST /payments/payment-intents — creates a Stripe payment intent for the authenticated user's customer and returns the client secret. Accepts an optional idempotency key so a retried submission reuses the same intent instead of double-charging. - POST /payments/checkout — creates a Stripe Checkout session (subscription or payment mode) and returns the hosted-checkout URL. Adds createPaymentIntent()/createCheckoutSession() to StripeService and PaymentsService, the two request DTOs, and documents the endpoints.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #371
Summary
The payments module already covered customers, subscriptions, invoices and signature-verified webhooks with subscription sync — but it had no way to create a payment intent or initiate a checkout flow (acceptance criterion #1). This PR adds both.
Changes
POST /payments/payment-intents— creates a Stripe payment intent for the authenticated user's customer and returns theclientSecretfor the frontend to confirm. Accepts an optionalidempotencyKey, forwarded to Stripe as a request idempotency key, so a retried payment submission reuses the original intent instead of double-charging.POST /payments/checkout— creates a Stripe Checkout session insubscription(default) orpaymentmode and returns the hosted-checkouturl.StripeService:createPaymentIntent(params, options?)andcreateCheckoutSession(params)wrappers over the Stripe SDK.PaymentsService:createPaymentIntent()/createCheckoutSession()that resolve (or create) the caller's Stripe customer, then delegate toStripeService.CreatePaymentIntentDto,CreateCheckoutSessionDto) withclass-validatorrules matching the module's conventions.src/payments/README.mddocuments the new endpoints.Acceptance criteria mapping
payments-webhook.controller.ts/stripe.service.constructEvent).subscription.entity.ts,upsertSubscriptionFromStripe).webhook-event.entity.ts; payment-retry idempotency via the newidempotencyKey.src/payments/README.mdupdated.Verified locally against the repo's CI checks:
npx tsc --noEmitandnpm run buildboth pass.