PHP code example of alexvargash / laravel-stripe-plaid

1. Go to this page and download the library: Download alexvargash/laravel-stripe-plaid 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/ */

    

alexvargash / laravel-stripe-plaid example snippets


return [

    /*
    |--------------------------------------------------------------------------
    | Environment
    |--------------------------------------------------------------------------
    |
    | The environment on which the API host will be set up, the accepted values
    | are: sandbox, development and production.
    | https://plaid.com/docs/api/#api-host
    |
    */
    'environment' => env('PLAID_ENVIRONMENT', ''),

    /*
    |--------------------------------------------------------------------------
    | Secret
    |--------------------------------------------------------------------------
    |
    | Private API key, here you need to add the respective secret key based on
    | the environment that is set up. This value can be found on your Plaid
    | account under the keys section.
    | https://plaid.com/docs/api/tokens/#token-endpoints
    |
    */
    'secret' => env('PLAID_SECRET', ''),

    /*
    |--------------------------------------------------------------------------
    | Client Id
    |--------------------------------------------------------------------------
    |
    | The client id is an identifier for the Plaid account and can be found
    | on your Plaid account under the keys section. This value is always
    | the same, doesn't change based on environment.
    | https://plaid.com/docs/api/tokens/#token-endpoints
    |
    */
    'client_id' => env('PLAID_CLIENT_ID', ''),

    /*
    |--------------------------------------------------------------------------
    | Client Name
    |--------------------------------------------------------------------------
    |
    | The name of your application, as it should be displayed in Link.
    | https://plaid.com/docs/api/tokens/#token-endpoints
    |
    */
    'client_name' => env('PLAID_CLIENT_NAME', ''),

    /*
    |--------------------------------------------------------------------------
    | Language
    |--------------------------------------------------------------------------
    |
    | The language that Link should be displayed in.
    | When using a Link customization, the language configured here must match the setting
    | in the customization, or the customization will not be applied.
    | Supported languages are: English ('en'), French ('fr'), Spanish ('es'), Dutch ('nl')
    | https://plaid.com/docs/api/tokens/#token-endpoints
    |
    */
    'language' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Country Codes
    |--------------------------------------------------------------------------
    |
    | Specify an array of Plaid-supported country codes using the ISO-3166-1 alpha-2 country code standard.
    | Note that if you initialize with a European country code, your users will see the European consent panel
    | during the Link flow.
    | If Link is launched with multiple country codes, only products that you are enabled for in all countries will be used by Link.
    | Supported country codes are: US, CA, ES, FR, GB, IE, NL. Example value: ['US', 'CA'].
    | https://plaid.com/docs/api/tokens/#token-endpoints
    |
    */
    'country_codes' => ['US'],

    /*
    |--------------------------------------------------------------------------
    | Products
    |--------------------------------------------------------------------------
    |
    | List of Plaid product(s) you wish to use. If launching Link in update mode,
    | should be omitted; 

use AlexVargash\LaravelStripePlaid\StripePlaid;

$clientUserId = 'client_user_id';

$stripePlaid = new StripePlaid();
$linkToken   = $stripePlaid->createLinkToken($clientUserId);

use AlexVargash\LaravelStripePlaid\StripePlaid;

$accountId   = 'plaid_link_account_id';
$publicToken = 'plaid_link_public_token';

$stripePlaid = new StripePlaid();
$stripeToken = $stripePlaid->getStripeToken($publicToken, $accountId);

use AlexVargash\LaravelStripePlaid\Facades\StripePlaid;

$clientUserId = 'your_end_user_id';

$linkToken    = StripePlaid::createLinkToken($clientUserId);

use AlexVargash\LaravelStripePlaid\Facades\StripePlaid;

$accountId   = 'plaid_link_account_id';
$publicToken = 'plaid_link_public_token';

$stripeToken = StripePlaid::getStripeToken($publicToken, $accountId);

use AlexVargash\LaravelStripePlaid\StripePlaid;

$secret      = 'your_plaid_secret_key';
$clientId    = 'your_plaid_client_id';
$environment = 'sandbox';
$accountId   = 'plaid_link_account_id';
$publicToken = 'plaid_link_public_token';

$stripeToken = StripePlaid::make($secret, $clientId, $environment)->getStripeToken($publicToken, $accountId);

public function render($request, Exception $exception)
{
    if ($exception instanceof \AlexVargash\LaravelStripePlaid\Exceptions\PlaidException) {
        // Manage exception here ...
    }

    return parent::render($request, $exception);
}
bash
php artisan vendor:publish --provider="AlexVargash\LaravelStripePlaid\StripePlaidServiceProvider" --tag="config"