Prood
PackagesPayment Providers

@prood/payment-stripe

Stripe Payment Element provider via PaymentIntents — the default payment gateway.

@prood/payment-stripe implements the PaymentProvider interface for Stripe, using the Payment Element and PaymentIntents API.

Installation

pnpm add @prood/payment-stripe

Usage

import { StripePaymentProvider } from '@prood/payment-stripe'

const provider = new StripePaymentProvider({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
  publishableKey: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
})

Via commerce factory (preferred in apps):

import { getPaymentProvider } from '@prood/commerce'
const provider = await getPaymentProvider('stripe', orgId)

Configuration

FieldEnv fallbackRequiredDescription
secretKeySTRIPE_SECRET_KEYYesServer-side secret key
webhookSecretSTRIPE_WEBHOOK_SECRETWebhooksWebhook signing secret
publishableKeyNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYClient UIPublishable key for Payment Element

Per-tenant overrides via dashboard Integrations → Stripe.

Payment flow

  1. createSession() → creates Stripe PaymentIntent
  2. Client renders Payment Element with clientSecret
  3. Customer submits → Stripe handles 3DS if required
  4. confirmSession() → verifies PaymentIntent status
  5. Webhook payment_intent.succeeded → async confirmation

Webhook events

EventAction
payment_intent.succeededMark order as confirmed
payment_intent.payment_failedMark order as failed
charge.refundedUpdate order refund status

Webhook URL: https://checkout.example.com/api/webhooks/stripe/{orgId}

Refunds

const result = await provider.refund({
  sessionId: 'pi_xxx',
  amount: 5000, // partial refund in minor units
  reason: 'Customer request',
})

Test mode

Use Stripe test keys (sk_test_..., pk_test_...):

CardResult
4242 4242 4242 4242Success
4000 0000 0000 32203DS required
4000 0000 0000 9995Declined

On this page