Technical Documentation

STRIPE Pay Platform Architecture & Integration Guide

Reference documentation for the payment pipeline, Stripe Connect Destination Charges model, asynchronous ACH Direct Debit states, webhook verification, and PCI DSS scope.

1. Stripe Connect Charge Model: Destination Charges

STRIPE Pay implements Destination Charges with Stripe Connect Express accounts. When a customer pays a verified merchant:

  • The server validates the merchant's ConnectedAccount record and refuses Destination Charges unless chargesEnabled and onboardingComplete are confirmed by Stripe.
  • Stripe creates the charge on the platform account with transfer_data.destination and application_fee_amount calculated server-side in integer cents.
  • Refunds issued through POST /api/refunds/[id]/review pass reverse_transfer: true and refund_application_fee: true (configurable per policy) to keep platform and merchant balances synchronized.

2. Asynchronous US ACH Direct Debit Lifecycle

ACH payments never transition to SUCCEEDED on creation or frontend confirmation. The enforced state progression is:

REQUIRES_PAYMENT_METHOD -> REQUIRES_CONFIRMATION -> PROCESSING (Unsettled)
  |-- payment_intent.succeeded       -> SUCCEEDED (Cleared + Ledger CREDIT)
  |-- payment_intent.payment_failed  -> FAILED / RETURNED
  |-- payment_intent.canceled        -> CANCELED
  |-- charge.dispute.created         -> RETURNED + SecurityEvent (CRITICAL)

Ensure US ACH Direct Debit (us_bank_account) and Financial Connections are explicitly activated in your Stripe Dashboard before enabling live bank payments.

3. Webhook Endpoint & Verified Event Catalog

Register POST /api/webhooks/stripe in your Stripe Dashboard and configure STRIPE_WEBHOOK_SECRET. Every incoming event is verified against the raw request payload, persisted to WebhookEvent before acknowledgment, and deduplicated by stripeEventId.

payment_intent.succeeded
payment_intent.payment_failed
payment_intent.processing
payment_intent.canceled
charge.refunded
charge.dispute.created
customer.created
customer.updated
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
invoice.created
invoice.finalized
invoice.paid
invoice.payment_failed
account.updated
account.application.deauthorized
payout.paid
payout.failed

4. PCI DSS Responsibility Boundary

STRIPE Pay collects all card credentials exclusively inside Stripe Elements iframes and bank credentials via Stripe Financial Connections. Our PostgreSQL database stores only Stripe object identifiers (pm_*, pi_*, cus_*), masked last-4 digits, brand, and expiration month/year.

Operators deploying STRIPE Pay to production must maintain HTTPS/TLS across all origins, rotate AUTH_SECRET and Stripe keys, enforce MFA on administrative accounts, and independently complete their annual PCI DSS Self-Assessment Questionnaire (SAQ A) as required by their acquiring agreements.