PHP code example of adsy2010 / laravel-stripe-wrapper

1. Go to this page and download the library: Download adsy2010/laravel-stripe-wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adsy2010 / laravel-stripe-wrapper example snippets


'providers' => [
    ...
    \Adsy2010\LaravelStripeWrapper\LaravelStripeWrapperServiceProvider::class,
    ...
],

'providers' => [
    ...
    \Adsy2010\LaravelStripeWrapper\LaravelStripeWrapperServiceProvider::class,
    \Adsy2010\LaravelStripeWrapper\LaravelStripeWrapperMigrationServiceProvider::class,
    ...
],

(new StripeCredential)
    ->store(['key' => 'Public Key', 'value' => 'YOUR_STRIPE_PUBLIC_API_KEY_HERE'])
    ->  ->

$stripe = StripeCredentialScope::client([StripeScope::PRODUCTS, StripeScope::SECRET], 'w');

(new StripeProduct)->store(['name'=>'my test product']);

(new StripeProduct)->store(['name'=>'test product also stored locally'], true);

(new StripeProduct)->retrieve('prod_123456789'); //add true to update the local database

(new StripeProduct)->retrieveAll(['active' => 1]);

(new StripeProduct)->retrieveAll([], true); //retrieve all with no filtering

(new StripeProduct)->change('prod_123456789', ['name'=>'new product name', ...]); //add true to update the local database

(new StripeProduct)->trash('prod_123456789'); //add true to update the local database

$customerDetails = [
    'email' => '[email protected]',
    'name' => 'Bob Smith'
];

(new StripeCustomer)->store($customerDetails);

$customerDetails = [
    'email' => '[email protected]',
    'name' => 'Bob Smith'
];

(new StripeCustomer)->store($customerDetails, true);

(new StripeCustomer)->retrieve('cust_123456789'); //add true to update the local database

(new StripeCustomer)->retrieveAll(['limit' => 3]); //add true to update the local database

(new StripeCustomer)->retrieveAll([], true); //retrieve all with no filtering

$newcustomerDetails = [
    'email' => '[email protected]',
    'name' => 'Bobby Smith'
];

(new StripeCustomer)->change('cust_123456789', $newCustomerData); //add true to update the local database

(new StripeCustomer)->trash('cust_123456789'); //add true to update the local database
bash
php artisan vendor:publish --provider=Adsy2010\LaravelStripeWrapper\LaravelStripeWrapperServiceProvider
bash
php artisan vendor:publish --tag='credential-migrations'
php artisan vendor:publish --tag='customer-migrations'
php artisan vendor:publish --tag='product-migrations'