This project is a Laravel 7 demo that showcases multi-platform payment processing. Authenticated users can submit payments in multiple currencies and complete them through PayPal or Stripe with provider-specific approval flows.
- Dashboard with authenticated payment form for entering amount, currency, and payment platform.
- Dynamic UI that reveals platform-specific inputs (Stripe card widget, PayPal notice) based on the selected provider.
- PayPal integration: creates orders, redirects for approval, and captures the transaction after the user returns.
- Stripe integration: creates and confirms PaymentIntents, including a dedicated 3D Secure/Strong Customer Authentication step when required.
- Currency and payment platform records seeded for quick setup across USD, EUR, GBP, and JPY.
- Simple flash-message feedback for successful payments and graceful fallbacks for cancel/error states.
- Controllers:
HomeControllerrenders the dashboard with available currencies and platforms;PaymentControllerhandles pay/approval/cancel endpoints and delegates to platform services. - Resolver:
PaymentPlatformResolvermaps a platform ID to a service class defined inconfig/services.php, enabling polymorphic payment handling. - Services:
PayPalServiceandStripeServiceencapsulate provider-specific API calls and approval logic, both using the sharedConsumesExternalServicestrait for authenticated HTTP requests. - Models:
CurrencyandPaymentPlatformback the selectable options in the UI and are populated via migrations/seeders.
- Install dependencies
composer install npm install && npm run dev - Configure environment
- Copy
.env.exampleto.envand set your database credentials. - Add your payment credentials:
PAYPAL_BASE_URI=https://api-m.sandbox.paypal.com PAYPAL_CLIENT_ID=your-client-id PAYPAL_CLIENT_SECRET=your-client-secret STRIPE_BASE_URI=https://api.stripe.com STRIPE_KEY=pk_test_xxx STRIPE_SECRET=sk_test_xxx
- Copy
- Generate app key and run migrations/seeders
php artisan key:generate php artisan migrate --seed
- Serve the app
Register/login, then submit a payment using the provided form.
php artisan serve
- Add a new provider by creating a service class with
handlePaymentandhandleApprovalmethods, registering it underconfig/services.php, and seeding a matchingPaymentPlatformentry. - Implement webhooks for asynchronous events (e.g., refunds, chargebacks) to complement the controller-based approval flow.
- Enhance UX with richer error messaging, loading states during payment submission, or currency-specific validation rules.
This demo is open-sourced software licensed under the MIT license.