Laravel Stripe Connect Save Abandoned

? Stripe Connect binding for Laravel

Project README

Laravel Stripe Connect

Packagist Packagist Build Status Scrutinizer Code Quality

⚠️ Deprecated, looking for a competitor. See this reddit post.

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.

Installation

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

Usage

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;

Example #1: direct charge

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(); 

Example #2: save a customer then charge later

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(); 

Exemple #3: create a vendor account

You may want to create the vendor account before charging anybody. Just call createAccount with a User instance.

StripeConnect::createAccount($vendor);

Exemple #4: Charge with application fee

StripeConnect::transaction($token)
    ->amount(1000, 'usd')
    ->fee(50)
    ->from($customer)
    ->to($vendor)
    ->create(); 
Open Source Agenda is not affiliated with "Laravel Stripe Connect" Project. README Source: rap2hpoutre/laravel-stripe-connect
Stars
70
Open Issues
0
Last Commit
4 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating