Payment Gateway Integration
✅ Introduction
What it does: Connects payment processors to your SaaS platform Why it's useful: Enables secure payment collection from customers Location: Admin Panel → Settings → Payment Gateways
Payment gateway integration is essential for monetizing your WhatsMarkSaaS platform. This guide explains how to set up and manage payment gateways to process subscription payments from your tenants.
✅ Accessing Payment Gateway Settings
Navigation Path
- Login to Admin Panel
- Navigate to Settings → Payment Gateways
Required Permissions
admin.payments.view
- View payment settingsadmin.payments.edit
- Edit payment gateway configuration
✅ Stripe Integration
Stripe Setup

Location: Admin Panel → Settings → Payment Gateways → Stripe
Stripe is the primary payment processor for WhatsMarkSaaS:
Required Credentials:
- Publishable Key: Client-side API key
- Secret Key: Server-side API key
- Webhook Secret: For webhook verification
Configuration Steps:
- Create a Stripe account
- Navigate to Developers → API keys in Stripe Dashboard
- Copy the publishable and secret keys
- Enter the keys in your admin panel
- Enable Stripe as a payment method
Stripe Webhook Configuration
Webhook Setup:
In Stripe Dashboard, go to Developers → Webhooks
Add a new endpoint with your SaaS URL:
texthttps://yourdomain.com/stripe/webhook
Select events to listen for:
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
invoice.payment_succeeded
invoice.payment_failed
checkout.session.completed
Copy the webhook signing secret
Enter the secret in your admin panel
Testing Webhooks:
- Use Stripe's webhook tester in their dashboard
- Monitor webhook events in the system logs
- Verify proper event handling
Stripe Payment Flow


Understanding the subscription payment flow:
- Customer selects a plan
- System creates Stripe Checkout Session
- Customer completes payment on Stripe hosted page
- Stripe sends webhook notification
- System activates the subscription
- Invoice is generated and emailed to customer
✅ Payment Settings Configuration
Global Payment Settings
Location: Admin Panel → Settings → Payments
Configure general payment behavior:
Available Settings:
- Default Currency: Primary billing currency
- Currency Format: Symbol position and formatting
- Tax Handling: VAT/GST configuration
- Invoice Generation: Automatic or manual
- Payment Reminders: Notification schedule
- Failed Payment Actions: Retry strategy
Currency Management

Location: Admin Panel → Settings → Currencies
Configure multiple currencies:
Currency Options:
- Add/remove supported currencies
- Set exchange rates
- Configure display format
- Set default currency
- Enable/disable specific currencies
Tax Configuration

Location: Admin Panel → Settings → Taxes
Configure tax collection:
Tax Options:
- Tax Rates: Percentage for different regions
- Tax Names: VAT, GST, Sales Tax, etc.
- Tax Number Collection: Customer tax IDs
- Tax Exemptions: Rules for exemptions
- Tax Reporting: Report generation
✅ Invoice Management
Invoice Settings

Location: Admin Panel → Settings → Invoices
Configure invoice generation:
Invoice Options:
- Invoice Template: Design and layout
- Numbering Format: Sequential numbering
- Company Details: Information on invoice
- Payment Terms: Due date calculation
- Invoice Notes: Default footer text
- Logo: Company branding
Invoice Automation
Automation Options:
- Auto-Generation: Create on payment
- Email Delivery: Send automatically
- PDF Attachment: Include PDF version
- Payment Reminders: Before/after due date
- Receipt Generation: After payment
✅ Payment Analytics
Revenue Dashboard
Location: Admin Panel → Payments → Analytics
Monitor payment performance:
Available Metrics:
- Monthly Recurring Revenue (MRR): Subscription revenue
- Average Revenue Per User (ARPU): Revenue per tenant
- Customer Lifetime Value (CLV): Long-term value
- Churn Rate: Subscription cancellations
- Revenue Growth: Month-over-month change
- Payment Success Rate: Failed vs. successful
Transaction History

Location: Admin Panel → Payments → Transactions
View all payment transactions:
Transaction Information:
- Transaction ID and reference
- Payment amount and currency
- Payment status
- Payment method
- Tenant information
- Invoice reference
- Transaction date/time
✅ Subscription Management
Subscription Settings
Location: Admin Panel → Settings → Subscriptions
Configure subscription behavior:
Available Settings:
- Trial Handling: How trials are managed
- Upgrade/Downgrade: Proration settings
- Cancellation Policy: Immediate or end of term
- Grace Period: Days after failed payment
- Renewal Notifications: Reminder schedule
- Auto-Renewals: Enable/disable
Manual Subscription Management
Location: Admin Panel → Subscriptions
Manually manage tenant subscriptions:
Management Options:
- Create subscription manually
- Update subscription plan
- Cancel subscription
- Add one-time charges
- Apply discounts or credits
- Override subscription settings
✅ Additional Payment Options
PayPal Integration (Optional)
Location: Admin Panel → Settings → Payment Gateways → PayPal
If enabled, configure PayPal processing:
Required Credentials:
- Client ID: PayPal API identifier
- Client Secret: PayPal API secret
- Webhook ID: For webhook verification
Configuration Steps (similar to Stripe):
- Create PayPal Business account
- Generate API credentials
- Configure webhook endpoints
- Enter credentials in admin panel
- Enable PayPal as payment method
Manual Payment Methods (Optional)

Location: Admin Panel → Settings → Payment Gateways → Manual
Configure offline payment options:
Available Methods:
- Bank transfer
- Check payment
- Cash payment
- Custom payment methods
Configuration Options:
- Payment instructions
- Verification process
- Approval workflow
- Receipt generation
✅ Security Considerations
Payment Security
Ensuring secure payment processing:
- PCI Compliance: Using secure providers
- Data Protection: Minimal data storage
- SSL Requirement: Secure connections only
- Fraud Prevention: Basic screening measures
- Access Control: Restricted payment settings
Audit Logging

Location: Admin Panel → Payments → Logs
Monitor payment-related activities:
Log Information:
- User actions on payments
- Gateway API interactions
- Webhook events received
- System payment processing
- Error conditions and resolution
✅ Troubleshooting
Common Issues:
- Failed Webhooks: Check endpoint accessibility
- Declined Payments: Verify card validity
- Currency Mismatches: Check currency configuration
- Invoice Errors: Verify tax and pricing setup
- Subscription State Issues: Check webhook processing
Diagnostic Steps:
- Check payment logs for errors
- Verify webhook delivery in Stripe dashboard
- Test payment process in test mode
- Confirm API credentials are correct
- Verify proper event handling
✅ Best Practices
- Test Mode: Thoroughly test before going live
- Backup Credentials: Securely store API keys
- Regular Reconciliation: Compare with gateway reports
- Clear Communication: Transparent pricing and policies
- Proper Error Handling: User-friendly error messages
- Dunning Management: Process for failed payments
Next Steps
After setting up payment gateways, your WhatsMarkSaaS platform is ready to accept customers! Make sure to review the Troubleshooting Guide for common issues and solutions.