PHP code example of cinghie / yii2-paypal

1. Go to this page and download the library: Download cinghie/yii2-paypal 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/ */

    

cinghie / yii2-paypal example snippets


php composer.phar 

use cinghie\paypal\components\Paypal as PaypalComponent;
use cinghie\paypal\Paypal as PaypalModule;

'components' => [

    'paypal' => [
    	'class'        => 'cinghie\paypal\components\Paypal',
    	'clientId'     => 'YOUR_CLIENT_ID',
    	'clientSecret' => 'YOUR_CLIENT_SECRET',
    	'isProduction' => false,
    	'config' => [
    		'mode' => 'sandbox', // 'sandbox' (development mode) or 'live' (production mode)
    	]
    ]
    
],

'modules' => [

    'paypal' => [ 
    	'class' => PaypalModule::class, 
    	'paypalRoles' => ['admin'],
    	'showTitles' => false,
    ]
    
]

use cinghie\paypal\filters\BackendFilter as PaypalBackendFilter;

'modules' => [

    'paypal' => [
        'as backend' => PaypalBackendFilter::class,
    ],    

]

use cinghie\paypal\filters\FrontendFilter as PaypalFrontendFilter;

'modules' => [

    'paypal' => [
        'as backend' => PaypalBackendFilter::class,
    ],  

]