-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Overview
- Use Stripe Elements to handle PCI-safe card collection. Refer to Stripe documentation - CardElement/PaymentElement from Stripe.js. Current fields aren't secure for handling sensitive data, we can't be processing sensitive user data in our code.
- The last step of this ticket will be migrating to Tailwind CSS + shadcn/ui. There are two other tickets doing the same thing, so I would wait until one of them has a modified shadcn button and/or input field components and reuse it on this page. The rest
- Transaction fee card is already implemented. Migrate this to Tailwind. + shadcn.
Tasks
- Install
@stripe/stripe-jsand@stripe/react-stripe-jsdependencies - Create a
StripeProviderwrapper component (e.g.,StripeProvider.tsx) that initializes Stripe and providesElementscontext toDonationFormand child steps - Replace raw card input fields (
cardNumber,cardExpiry,cardCvc) in Step 2 with Stripe's<CardElement>or<PaymentElement> - Hook into
useStripeanduseElementshooks to capture card details securely - Migrate Step 2 donor info fields to shadcn
<Input>components (reuse from Steps 1 & 3 if available) - Migrate transaction fee card to Tailwind CSS + a shadcn component
- After backend connection ticket is completed (week 2): Integrate with backend
POST /payments/intentandPOST /donationsendpoints:- Call
POST /payments/intentin Step 3 confirm handler before creating donation - Pass returned
clientSecretto Stripe'sconfirmCardPayment() - On successful payment confirmation, call
POST /donationswith form data andpaymentIntentId - Handle errors from both endpoints and display to user
- Call
Acceptance Criteria
@stripe/stripe-jsand@stripe/react-stripe-jsare installedStripeProvidercomponent wraps the donation form and initializes Stripe with publishable key from environment- Step 2 displays
<CardElement>or<PaymentElement>instead of raw card input fields - Donor info fields (firstName, lastName, email) use shadcn
<Input>components - Transaction fee card is styled with Tailwind and shadcn
<Card> - Step 2 layout is cleaned up and uses no legacy CSS classes
- Form can advance through Steps 1-3 without validation errors
- Step 3 confirm button triggers payment intent creation and card confirmation with Stripe
- On successful payment confirmation, donation is created with
paymentIntentIdand user is taken to Step 4 - On failed payment confirmation, appropriate error message is displayed
- Provide a screenshot of the updated Step 2 layout (including summary and card element)
- No console errors or TypeScript mismatches
- no
donations.cssimport from Step 2 - Lint runs passes
Notes
- The backend
POST /payments/intentendpoint already exists; integrate with it, do not mock - Prefer waiting for Steps 1 & 3 Tailwind migration devs to push some reuseable components so you can reuse their shadcn component implementations for consistency, but if not feel free to make your own (then push asap, and notify others in slack so people know to use the component).
- Ensure webhook integration is tested after form submission to verify donation status updates
Metadata
Metadata
Assignees
Labels
No labels