Cartalyst LLC.
Stripe-laravel by Cartalyst
4
71
0
60
329

Preface

Introduction

A Laravel 5 integration for the Cartalyst Stripe package.

The package requires PHP 5.4+ and follows the FIG standard PSR-1, PSR-2 and PSR-4 to ensure a high level of interoperability between shared PHP code.

Have a read through the Installation Guide.

Setup

Installation

Cartalyst packages utilize Composer, for more information on how to install Composer please read the Composer Documentation.

Preparation

Open your composer.json file and add the following to the require array:

"cartalyst/stripe-laravel": "2.0.*"

Note: Make sure that after the required changes your composer.json file is valid by running composer validate.

Install the dependencies

Run Composer to install or update the new requirement.

php composer install

or

php composer update

Integration

Integration on Laravel 5 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.

In the $providers array add the following service provider for this package.

'Cartalyst\Stripe\Laravel\StripeServiceProvider',

In the $aliases array add the following facade for this package.

'Stripe' => 'Cartalyst\Stripe\Laravel\Facades\Stripe',

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 'stripe' array:

<?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' => '2015-01-11',
    ],

];

Usage

For usage, please refer to the Cartalyst Stripe package documentation, located here.

Just use the Laravel facade alias Stripe:: instead of the native call $stripe->.

Enjoy :)

You wont find fancy lifestyle graphics and marketing bravado here. Just cold... hard... code...

Code Well, Rock On!
Processing Payment...