Skip to content

Where this file lives

  • This path (docs/payments/stripe-paymentintent-card-saving.md) is inside the rakletv3 repo for review and maintenance.
  • This document describes the current implemented process for Stripe PaymentIntent card saving in Payment/Process.

Stripe PaymentIntent Card Saving

Generated: 2026-04-21 Repo: rakletadmin/rakletv3 Focus: Payment/Process Stripe card saving behavior.

Purpose

Raklet supports one-time Stripe payments and future off-session payments such as recurring donations and scheduled membership payments. Stripe should only save a PaymentIntent payment method for future use when the user selected a recurring/save-card option, or when the payment is already an off-session saved-card charge.

Scope

This document covers card payments processed through:

  • Application/Views/Shared/_StripeCreditCardForm.cshtml
  • Application/Controllers/PaymentController.cs
  • Services/BaseStripeCreditCardProcessing.cs

Stripe Checkout sessions have separate handling in BaseStripeCreditCardProcessing.ApplyCheckoutPaymentIntentOptions().

Business Rules

Scenario IsCardSavingEnabled offSessionPayment Stripe SetupFutureUsage Stripe OffSession
One-time payment with a new card false false null null
Recurring donation or explicit save-card payment true false off_session null
Saved-card off-session charge any true null true

SetupFutureUsage = "off_session" tells Stripe to attach the confirmed PaymentMethod to the Customer for future use. Do not set it for one-time payments where Raklet is not saving a CreditCardToken.

Flow

  1. _StripeCreditCardForm.cshtml creates a Stripe PaymentMethod with stripe.createPaymentMethod() and posts PaymentMethodId to PaymentController.Process.
  2. PaymentController.ProcessConfirmed() maps user choices to CreditCardChargeRequest.IsCardSavingEnabled.
  3. BaseStripeCreditCardProcessing.CreateOrUpdatePaymentIntentCreateOptions() sets SetupFutureUsage through GetPaymentIntentSetupFutureUsage().
  4. After successful confirmation, PaymentController creates a Raklet CreditCardToken only when the Stripe response marks the card as saved.

QA Checklist

  • One-time Stripe donation with IsRecurring = false should create a successful PaymentIntent without attaching a new PaymentMethod to the Stripe Customer for future use.
  • Recurring donation with IsRecurring = true should create a PaymentIntent with SetupFutureUsage = "off_session" and then create the scheduled donation record.
  • Membership payment with explicit save-card/update-card selection should save the card and create/update the scheduled payment linkage.
  • Existing saved-card off-session payments should keep using OffSession = true.