Created
October 6, 2015 02:13
-
-
Save bmadigan/d3f8aa37f96e01142d41 to your computer and use it in GitHub Desktop.
My Stripe Cartalyst laravel Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LARAVEL 5.1 | |
// composer.json | |
"cartalyst/stripe-billing-laravel": "~3.0" | |
//--------------------- | |
// config/app.php | |
//--------------------- | |
'providers' => [ | |
Cartalyst\Stripe\Billing\Laravel\StripeServiceProvider::class, | |
... | |
'aliases' => [ | |
'Stripe' => Cartalyst\Stripe\Laravel\Facades\Stripe::class, | |
//--------------------- | |
// Account Model | |
//--------------------- | |
use Cartalyst\Stripe\Billing\Laravel\Billable; | |
use Cartalyst\Stripe\Billing\Laravel\BillableContract; | |
... | |
class Account extends Model implements BillableContract | |
{ | |
use Billable; | |
... | |
//--------------------- | |
// Controller | |
//--------------------- | |
$account = Account::createNewAccount($request); | |
$account->createStripeCustomer([ | |
'email' => '[email protected]', | |
'description' => 'My Account Name' | |
]); | |
$account->subscription() | |
->onPlan('monthly') | |
->create(); | |
- See more at: http://laravelsnippets.com/members/snippets/cartalyst-laravel-stripe-steup#sthash.EjOYWxvv.dpuf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment