Skip to main content

Payment Integration

This guide covers integrating Stripe payments into your Twigz application.

Setup

1. Install Stripe SDK

2. Initialize Stripe

Payment Flow

1. Create Payment Intent

2. Confirm Payment

3. Handle Payment Status

Payment Methods

Card Payments

Apple Pay / Google Pay

Webhook Handling

Stripe Webhook Endpoint

Marketplace Fees

Calculate Platform Commission

Error Handling

Common Payment Errors

Testing

Test Cards

Test Webhooks

Best Practices

  1. Always validate payment amounts on the backend
  2. Use webhooks for reliable payment status updates
  3. Handle errors gracefully with user-friendly messages
  4. Test thoroughly with Stripe test cards
  5. Secure your keys - never expose secret keys in frontend code
Always use Stripe’s test mode during development and switch to live mode only when ready for production.