{"id":21391360,"url":"https://github.com/kun391/yii2-paypal","last_synced_at":"2025-08-22T19:17:54.287Z","repository":{"id":35704865,"uuid":"39982398","full_name":"kun391/yii2-paypal","owner":"kun391","description":"Component working with paypal for Yii2","archived":false,"fork":false,"pushed_at":"2022-10-29T04:31:58.000Z","size":103,"stargazers_count":16,"open_issues_count":3,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T15:22:58.423Z","etag":null,"topics":["paypal","php","restapi","yii","yii2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kun391.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-31T02:26:55.000Z","updated_at":"2025-01-09T19:49:33.000Z","dependencies_parsed_at":"2022-08-18T00:01:23.239Z","dependency_job_id":null,"html_url":"https://github.com/kun391/yii2-paypal","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kun391/yii2-paypal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kun391%2Fyii2-paypal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kun391%2Fyii2-paypal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kun391%2Fyii2-paypal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kun391%2Fyii2-paypal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kun391","download_url":"https://codeload.github.com/kun391/yii2-paypal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kun391%2Fyii2-paypal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265178385,"owners_count":23723251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["paypal","php","restapi","yii","yii2"],"created_at":"2024-11-22T13:26:09.450Z","updated_at":"2025-07-13T17:30:52.600Z","avatar_url":"https://github.com/kun391.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Process Payment with paypal for Yii2\n=========\n\n[![Build Status](https://travis-ci.org/kun391/yii2-paypal.svg?branch=master)](https://travis-ci.org/kun391/yii2-paypal)\n[![Latest Stable Version](https://poser.pugx.org/kun391/yii2-paypal/v/stable)](https://packagist.org/packages/kun391/yii2-paypal)\n[![Total Downloads](https://poser.pugx.org/kun391/yii2-paypal/downloads)](https://packagist.org/packages/kun391/yii2-paypal)\n[![Monthly Downloads](https://poser.pugx.org/kun391/yii2-paypal/d/monthly)](https://packagist.org/packages/kun391/yii2-paypal)\n[![Daily Downloads](https://poser.pugx.org/kun391/yii2-paypal/d/daily)](https://packagist.org/packages/kun391/yii2-paypal)\n\nRequirements\n====\n- PHP \u003e= 5.4\n- php5-curl (System)\n\nInstallation\n====\n\nAdd to the composer.json file following section:\n\n```\nphp composer.phar require --prefer-dist kun391/yii2-paypal:\"*\"\n```\n\nor\n\n```\n\"kun391/yii2-paypal\":\"dev-master\"\n```\n\nAdd to to you Yii2 config file this part with component settings:\n\n\u003e Create file config.php for RESTAPI and config.php for Classic API every where:\n\n- ClassicAPI\n\n```php\n/**\n * Information PAYPAL's enviroments for classic API\n * @var string\n */\n\n// E.g:\n// If enviroment is Development you should use mode = sandbox and endpoint = api.sandbox.paypal.com\n// [\n//     'acct1.UserName'  =\u003e 'nguyentruongthanh.dn-facilitator-1_api1.gmail.com',\n//     'acct1.Password'  =\u003e 'GRHYUV2DJHNBFTAA',\n//     'acct1.Signature' =\u003e 'APP9kKh6roKmPNKj6yBK5oSwdD39ADujX4sfPXjr.hGf1wjRi1THwoVq',\n//     'mode'            =\u003e 'sandbox',\n// ];\n\n// E.g:\n// If enviroment is live you should use mode = live\n// [\n//     'acct1.UserName'  =\u003e 'nguyentruongthanh.dn-facilitator-1_api1.gmail.com',\n//     'acct1.Password'  =\u003e 'GRHYUV2DJHNBFTAA',\n//     'acct1.Signature' =\u003e 'APP9kKh6roKmPNKj6yBK5oSwdD39ADujX4sfPXjr.hGf1wjRi1THwoVq',\n//     'mode'            =\u003e 'live',\n// ];\n\nreturn  [\n    'acct1.UserName'  =\u003e 'nguyentruongthanh.dn-facilitator-1_api1.gmail.com',\n    'acct1.Password'  =\u003e 'GRHYUV2DJHNBFTAA',\n    'acct1.Signature' =\u003e 'APP9kKh6roKmPNKj6yBK5oSwdD39ADujX4sfPXjr.hGf1wjRi1THwoVq',\n    'mode'            =\u003e 'sandbox',\n];\n\n```\n\n- RestAPI\n\n```php\n/**\n * Information PAYPAL's enviroments\n * @var string\n */\n\n// E.g:\n// If enviroment is Development you should use mode = sandbox and endpoint = api.sandbox.paypal.com\n// $setting = [\n//     'endpoint'       =\u003e 'api.sandbox.paypal.com',\n//     'client_id'      =\u003e 'AV92BhCOYzF4Vejrbphu1ksMn4KYSlvbzCTcbLdOMixBvAS7sQZhOvMNkMoG',\n//     'secret'         =\u003e 'EDdjYm7i8w2XZwWGyTqPfPDJim2dUV1hX_3dhY0fR-HulrENli6043rY_0GO1ro1gnkxVe3bMWNDikvq',\n//     'business_owner' =\u003e 'nguyentruongthanh.dn-facilitator-1@gmail.com',\n// ];\n\n// E.g:\n// If enviroment is live you should use mode = live and endpoint = api.paypal.com\n// $setting = [\n//     'endpoint'       =\u003e 'api.paypal.com',\n//     'client_id'      =\u003e 'AV92BhCOYzF4Vejrbphu1ksMn4KYSlvbzCTcbLdOMixBvAS7sQZhOvMNkMoG',\n//     'secret'         =\u003e 'EDdjYm7i8w2XZwWGyTqPfPDJim2dUV1hX_3dhY0fR-HulrENli6043rY_0GO1ro1gnkxVe3bMWNDikvq',\n//     'business_owner' =\u003e 'nguyentruongthanh.dn-facilitator-1@gmail.com',\n// ];\n\n$setting = [\n    'endpoint'       =\u003e 'api.sandbox.paypal.com',\n    'client_id'      =\u003e 'AX9sEz0g3cCzD_heoGyedx7LKSuEx1Lx7H8aGXIrzQmDhqV-V5bV0sbVFc195mNKbE81OkAPZZi_7dfa',\n    'secret'         =\u003e 'EDdjYm7i8w2XZwWGyTqPfPDJim2dUV1hX_3dhY0fR-HulrENli6043rY_0GO1ro1gnkxVe3bMWNDikvq',\n    'business_owner' =\u003e 'nguyentruongthanh.dn-facilitator-1@gmail.com',\n];\n\nreturn \\yii\\helpers\\ArrayHelper::merge(['config' =\u003e [\n        'mode'                   =\u003e 'sandbox',\n        'http.ConnectionTimeOut' =\u003e 60,\n        'log.LogEnabled'         =\u003e false,\n        'log.FileName'           =\u003e '@api/runtime/PayPal.log',\n        'log.LogLevel'           =\u003e 'FINE',\n    ]\n], $setting);\n```\n\n\u003e Add to config to component of file main.php:\n\n```php\n...\n'payPalClassic'    =\u003e [\n    'class'        =\u003e 'kun391\\paypal\\ClassicAPI',\n    'pathFileConfig' =\u003e '',\n],\n'payPalRest'               =\u003e [\n    'class'        =\u003e 'kun391\\paypal\\RestAPI',\n    'pathFileConfig' =\u003e '',\n    'successUrl' =\u003e '' //full url action return url\n    'cancelUrl' =\u003e '' //full url action return url\n],\n...\n```\n\n=========\n\nUsage\n====\n\n\u003e REST API\n\n- Create a invoice with paypal\n\n```php\n//define params for request \n$params = [\n    'currency' =\u003e 'Usd', // only support currency same PayPal\n    'email' =\u003e 'nguyentruongthanh.dn@gmail.com',\n    'items' =\u003e [\n        [\n            'name' =\u003e 'Vinamilk',\n            'quantity' =\u003e 2,\n            'price' =\u003e 100\n        ],\n        [\n            'name' =\u003e 'Pepsi',\n            'quantity' =\u003e 3,\n            'price' =\u003e 90\n        ]\n    ]\n];\n\n// information invoice response\n$response = Yii::$app-\u003epayPalRest-\u003ecreateInvoice($params);\n```\n\n- Get link checkout on PayPal\n\n```php\n//define params for request \n$params = [\n    'currency' =\u003e 'USD', // only support currency same PayPal\n    'description' =\u003e 'Buy some item',\n    'total_price' =\u003e 470,\n    'email' =\u003e 'nguyentruongthanh.dn@gmail.com',\n    'items' =\u003e [\n        [\n            'name' =\u003e 'Vinamilk',\n            'quantity' =\u003e 2,\n            'price' =\u003e 100\n        ],\n        [\n            'name' =\u003e 'Pepsi',\n            'quantity' =\u003e 3,\n            'price' =\u003e 90\n        ]\n    ]\n];\n\n$response = Yii::$app-\u003epayPalRest-\u003egetLinkCheckOut($params);\n```\n\n\u003e CLASSIC API\n\n- Get Information Account\n\n```php\n\nAttribute matchCriteria you can specify either NAME or NONE. Default: None\nAttribute firstName and lastName (Required) if matchCriteria is name.\n\n$params = [\n    'email' =\u003e 'nguyentruongthanh.dn@gmail.com',\n    'matchCriteria' =\u003e 'name',\n    'firstName' =\u003e 'Thanh',\n    'lastName'  =\u003e 'Nguyen'\n];\n\n$response = Yii::$app-\u003epayPalClassic-\u003egetAccountInfo($params);\n```\n\n- Send money (Mass Pay)\n\n```php\n$params = [\n    'email' =\u003e 'nguyentruongthanh.dn@gmail.com',\n    'balance' =\u003e 200,\n];\n\n$response = Yii::$app-\u003epayPalClassic-\u003esendMoney($params);\n``\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkun391%2Fyii2-paypal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkun391%2Fyii2-paypal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkun391%2Fyii2-paypal/lists"}