Перейти к основному содержимому

Payment Gateways (Stripe & PayPal)

FeedbackPulse SaaS supports Stripe and PayPal for subscription billing. You can enable one or both.


💰 How Биллинг Works

  1. You create тарифные планы in Admin → Plans (e.g., Starter $9.99/mo, Pro $29.99/mo)
  2. Each plan has a Stripe Price ID and/or PayPal Plan ID
  3. When a tenant subscribes, they're redirected to Stripe Checkout or PayPal
  4. After payment, FeedbackPulse activates their subscription
  5. Вебхуки keep everything in sync (renewals, cancellations, failures)

💳 Stripe Setup

Step 1: Create a Stripe Account

  1. Зарегистрируйтесь at stripe.com
  2. Complete identity verification
  3. Get your Ключи API from Developers → API Keys

Step 2: Get Your API Keys

KeyWhere to Find.env Variable
Publishable KeyПанель управления → Developers → API KeysSTRIPE_PUBLISHABLE_KEY
Secret KeyПанель управления → Developers → API KeysSTRIPE_SECRET_KEY
STRIPE_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxxxxxxx
STRIPE_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxx

🧪 Testing: Use pk_test_ and sk_test_ keys for sandbox mode.

Step 3: Create Продукты & Prices in Stripe

For each subscription plan, create a recurring price in Stripe:

  1. Перейдите в Продукты → Add Product
  2. Name: "FeedbackPulse Starter" (or your plan name)
  3. Add a recurring price: $9.99 / month
  4. Optionally add an annual price: $99.99 / year
  5. Copy the Price ID (starts with price_)

In FeedbackPulse, go to Admin → Plans → Edit:

Plan FieldStripe Value
Stripe Monthly Price IDprice_xxxxxxxxx (monthly price ID)
Stripe Annual Price IDprice_xxxxxxxxx (annual price ID)

Step 5: Set Up Stripe Вебхуки

This is critical — webhooks keep subscriptions in sync.

  1. Перейдите в Stripe Панель управления → Developers → Вебхуки
  2. Click Add endpoint
  3. Endpoint URL: https://yourdomain.com/webhooks/stripe
  4. Events to listen for:
    • checkout.session.completed
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • invoice.payment_failed
  5. Copy the Signing Secret (starts with whsec_)
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxx

Step 6: Enable in Admin Panel

Перейдите в Admin → Настройки → Payments:

  • Toggle Stripe to enabled
  • Paste your publishable and secret keys
  • Save

💰 PayPal Setup

Step 1: Create a PayPal Business Account

  1. Зарегистрируйтесь at paypal.com/business
  2. Перейдите в developer.paypal.com

Step 2: Create a REST API App

  1. Перейдите в Панель управления → Apps & Credentials
  2. Click Create App
  3. Name: "FeedbackPulse"
  4. Copy the Client ID and Secret
PAYPAL_CLIENT_ID=your_client_id
PAYPAL_CLIENT_SECRET=your_client_secret
PAYPAL_MODE=live

🧪 Testing: Use PAYPAL_MODE=sandbox and sandbox credentials.

Step 3: Create Subscription Plans in PayPal

  1. Перейдите в PayPal Developer Панель управления → Subscriptions → Plans
  2. Create a product first, then create plans for it
  3. Copy each Plan ID (starts with P-)

In Admin → Plans → Edit:

Plan FieldPayPal Value
PayPal Monthly Plan IDP-xxxxxxxxx (monthly plan)
PayPal Annual Plan IDP-xxxxxxxxx (annual plan)

Step 5: Set Up PayPal Вебхуки

  1. In PayPal Developer Панель управления → Вебхуки
  2. Add webhook URL: https://yourdomain.com/webhooks/paypal
  3. Select events:
    • BILLING.SUBSCRIPTION.CREATED
    • BILLING.SUBSCRIPTION.ACTIVATED
    • BILLING.SUBSCRIPTION.UPDATED
    • BILLING.SUBSCRIPTION.CANCELLED
    • BILLING.SUBSCRIPTION.SUSPENDED
    • PAYMENT.SALE.COMPLETED
  4. Copy the Webhook ID
PAYPAL_WEBHOOK_ID=your_webhook_id

Step 6: Enable in Admin Panel

Перейдите в Admin → Настройки → Payments:

  • Toggle PayPal to enabled
  • Paste your Client ID and Secret
  • Save

🧪 Testing Payments

Stripe Test Mode

Use test card numbers:

  • Success: 4242 4242 4242 4242
  • Decline: 4000 0000 0000 0002
  • 3D Secure: 4000 0025 0000 3155

Expiry: any future date. CVC: any 3 digits.

PayPal Sandbox

  1. Перейдите в developer.paypal.com → Sandbox → Accounts
  2. Use the generated sandbox buyer account to test payments

Multi-Currency Support

Plans can be assigned different currencies (e.g., USD, EUR, GBP). Configure the list of supported currencies in Admin > Настройки > Payments under the Supported Currencies field.

  • Stripe: Checkout sessions automatically pass the plan's currency, so customers are charged in the correct currency.
  • PayPal: Subscription requests include currency metadata matching the plan's configured currency.
  • Currency is stored on each invoice for accurate record-keeping.

For details on configuring supported currencies, see Platform Настройки.


🔒 Безопасность Notes

  • Ключи API are stored encrypted in the platform_settings table
  • Webhook signatures are verified (Stripe HMAC, PayPal signature validation)
  • Payment events are logged in the payment_events table (Admin → Payments)
  • Event deduplication prevents double-processing of webhooks

⏭️ Следующие шаги