Cartalyst LLC.
Stripe-laravel by Cartalyst
4
71
0
58
336

Preface

Introduction

A Laravel 10 integration for the Cartalyst Stripe package.

The package requires PHP 8.1+ and follows the FIG standard PSR-4 to ensure a high level of interoperability between shared PHP code and is fully unit-tested.

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": "^15.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 10 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::class,

In the $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 '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' => '2019-02-19',
    ],

];

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...