1. Go to this page and download the library: Download kun391/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/ */
kun391 / yii2-paypal example snippets
/**
* Information PAYPAL's enviroments for classic API
* @var string
*/
// E.g:
// If enviroment is Development you should use mode = sandbox and endpoint = api.sandbox.paypal.com
// [
// 'acct1.UserName' => 'nguyentruongthanh.dn-facilitator-1_api1.gmail.com',
// 'acct1.Password' => 'GRHYUV2DJHNBFTAA',
// 'acct1.Signature' => 'APP9kKh6roKmPNKj6yBK5oSwdD39ADujX4sfPXjr.hGf1wjRi1THwoVq',
// 'mode' => 'sandbox',
// ];
// E.g:
// If enviroment is live you should use mode = live
// [
// 'acct1.UserName' => 'nguyentruongthanh.dn-facilitator-1_api1.gmail.com',
// 'acct1.Password' => 'GRHYUV2DJHNBFTAA',
// 'acct1.Signature' => 'APP9kKh6roKmPNKj6yBK5oSwdD39ADujX4sfPXjr.hGf1wjRi1THwoVq',
// 'mode' => 'live',
// ];
return [
'acct1.UserName' => 'nguyentruongthanh.dn-facilitator-1_api1.gmail.com',
'acct1.Password' => 'GRHYUV2DJHNBFTAA',
'acct1.Signature' => 'APP9kKh6roKmPNKj6yBK5oSwdD39ADujX4sfPXjr.hGf1wjRi1THwoVq',
'mode' => 'sandbox',
];
/**
* Information PAYPAL's enviroments
* @var string
*/
// E.g:
// If enviroment is Development you should use mode = sandbox and endpoint = api.sandbox.paypal.com
// $setting = [
// 'endpoint' => 'api.sandbox.paypal.com',
// 'client_id' => 'AV92BhCOYzF4Vejrbphu1ksMn4KYSlvbzCTcbLdOMixBvAS7sQZhOvMNkMoG',
// 'secret' => 'EDdjYm7i8w2XZwWGyTqPfPDJim2dUV1hX_3dhY0fR-HulrENli6043rY_0GO1ro1gnkxVe3bMWNDikvq',
// 'business_owner' => '[email protected]',
// ];
// E.g:
// If enviroment is live you should use mode = live and endpoint = api.paypal.com
// $setting = [
// 'endpoint' => 'api.paypal.com',
// 'client_id' => 'AV92BhCOYzF4Vejrbphu1ksMn4KYSlvbzCTcbLdOMixBvAS7sQZhOvMNkMoG',
// 'secret' => 'EDdjYm7i8w2XZwWGyTqPfPDJim2dUV1hX_3dhY0fR-HulrENli6043rY_0GO1ro1gnkxVe3bMWNDikvq',
// 'business_owner' => '[email protected]',
// ];
$setting = [
'endpoint' => 'api.sandbox.paypal.com',
'client_id' => 'AX9sEz0g3cCzD_heoGyedx7LKSuEx1Lx7H8aGXIrzQmDhqV-V5bV0sbVFc195mNKbE81OkAPZZi_7dfa',
'secret' => 'EDdjYm7i8w2XZwWGyTqPfPDJim2dUV1hX_3dhY0fR-HulrENli6043rY_0GO1ro1gnkxVe3bMWNDikvq',
'business_owner' => '[email protected]',
];
return \yii\helpers\ArrayHelper::merge(['config' => [
'mode' => 'sandbox',
'http.ConnectionTimeOut' => 60,
'log.LogEnabled' => false,
'log.FileName' => '@api/runtime/PayPal.log',
'log.LogLevel' => 'FINE',
]
], $setting);
Attribute matchCriteria you can specify either NAME or NONE. Default: None
Attribute firstName and lastName (Required) if matchCriteria is name.
$params = [
'email' => '[email protected]',
'matchCriteria' => 'name',
'firstName' => 'Thanh',
'lastName' => 'Nguyen'
];
$response = Yii::$app->payPalClassic->getAccountInfo($params);
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.