A Laravel 5.4 integration for the Cartalyst Stripe package.
The package requires PHP 5.6.4+ and follows the FIG standard PSR-1, PSR-2 and PSR-4 to ensure a high level of interoperability between shared PHP code.
composer.json file and add the following to the
Note: Make sure that after the required changes your
composer.jsonfile is valid by running
Install the dependencies
Run Composer to install or update the new requirement.
php composer install
php composer update
Integration on Laravel 5.4 is straightforward.
Set the Service Provider and Facade alias
After installing the package, open your Laravel config file located at
config/app.php and add the following lines.
$providers array add the following service provider for this package.
$aliases array add the following facade for this package.
'Stripe' => Cartalyst\Stripe\Laravel\Facades\Stripe::class,
Set the Api Key
Now you need to setup the Stripe API key, to do this open or create the
config/services.php file, and add or update the
<?php return [ 'stripe' => [ 'secret' => 'your-stripe-key-here', ], ];
Set the Api Version (optional)
This step is not necessary, but in case you need to use a previous version of Stripe you can do same process as above and add a
'version' key on the array:
<?php return [ 'stripe' => [ 'secret' => 'your-stripe-key-here', 'version' => '2016-07-06', ], ];
For usage, please refer to the Cartalyst Stripe package documentation, located here.
Just use the Laravel facade alias
Stripe:: instead of the native call