Marketplaces and platforms use Stripe Connect to accept money and pay out to third parties. Connect provides a complete set of building blocks to support virtually any business model, including on-demand businesses, e‑commerce, crowdfunding, fintech, and travel and events.
Create a marketplace application with this helper for Stripe Connect.
Install via composer
composer require rap2hpoutre/laravel-stripe-connect
Add your stripe credentials in .env:
STRIPE_KEY=pk_test_XxxXXxXXX
STRIPE_SECRET=sk_test_XxxXXxXXX
Run migrations:
php artisan migrate
You can make a single payment from a user to another user or save a customer card for later use. Just remember to import the base class via:
use Rap2hpoutre\LaravelStripeConnect\StripeConnect;The customer gives his credentials via Stripe Checkout and is charged.
It's a one shot process. $customer and $vendor must be User instances. The $token must have been created using Checkout or Elements.
StripeConnect::transaction($token)
->amount(1000, 'usd')
->from($customer)
->to($vendor)
->create(); Sometimes, you may want to register a card then charge later. First, create the customer.
StripeConnect::createCustomer($token, $customer);Then, (later) charge the customer without token.
StripeConnect::transaction()
->amount(1000, 'usd')
->useSavedCustomer()
->from($customer)
->to($vendor)
->create(); You may want to create the vendor account before charging anybody.
Just call createAccount with a User instance.
StripeConnect::createAccount($vendor);StripeConnect::transaction($token)
->amount(1000, 'usd')
->fee(50)
->from($customer)
->to($vendor)
->create(); 