# Dual Payment Gateway Upgrade

This build upgrades the Social Dynamics AI Suite from Stripe-only recurring billing to **Stripe + Razorpay**.

## What changed

- Customers can choose Stripe or Razorpay on the billing screen.
- Subscription gateway is stored in the database per user account.
- Payment history stores the provider for each payment.
- Stripe continues to use hosted Checkout and Customer Portal.
- Razorpay uses Subscriptions + Standard Checkout.
- Razorpay checkout success is verified server-side before account activation.
- Razorpay webhooks are verified using the raw request body and webhook secret.
- Razorpay subscription payment failure enters the existing past-due/grace/suspension flow.
- Razorpay recurring charge success restores active access.
- Super Admin now shows the gateway for subscriptions and payments.
- Existing local Stripe-only databases receive lightweight startup schema extensions.

## Webhook endpoints

- Stripe: `/webhooks/stripe`
- Razorpay: `/webhooks/razorpay`

## Important production rule

Do not keep two active recurring subscriptions for one customer. The backend blocks creation of another live recurring subscription when an existing Stripe or Razorpay subscription ID is already active. Cancel or migrate the old subscription first.
