{"id":19307774,"url":"https://github.com/sger/laravel-paypal","last_synced_at":"2025-04-22T13:31:39.776Z","repository":{"id":57048520,"uuid":"62881490","full_name":"sger/laravel-paypal","owner":"sger","description":"Laravel Paypal is a bridge for Laravel 5","archived":false,"fork":false,"pushed_at":"2016-07-09T06:20:31.000Z","size":13,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T00:09:20.227Z","etag":null,"topics":[],"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/sger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-08T10:41:54.000Z","updated_at":"2025-01-24T09:59:27.000Z","dependencies_parsed_at":"2022-08-23T19:10:13.909Z","dependency_job_id":null,"html_url":"https://github.com/sger/laravel-paypal","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sger%2Flaravel-paypal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sger%2Flaravel-paypal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sger%2Flaravel-paypal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sger%2Flaravel-paypal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sger","download_url":"https://codeload.github.com/sger/laravel-paypal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250248669,"owners_count":21399315,"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":[],"created_at":"2024-11-10T00:12:29.697Z","updated_at":"2025-04-22T13:31:39.552Z","avatar_url":"https://github.com/sger.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Laravel Paypal\n=============\n\n[![Build Status](https://travis-ci.org/sger/laravel-paypal.svg?branch=master)](https://travis-ci.org/sger/laravel-paypal)\n[![Code Climate](https://codeclimate.com/github/sger/laravel-paypal/badges/gpa.svg)](https://codeclimate.com/github/sger/laravel-paypal)\n[![Test Coverage](https://codeclimate.com/github/sger/laravel-paypal/badges/coverage.svg)](https://codeclimate.com/github/sger/laravel-paypal/coverage)\n[![Issue Count](https://codeclimate.com/github/sger/laravel-paypal/badges/issue_count.svg)](https://codeclimate.com/github/sger/laravel-paypal)\n\nLaravel Paypal is a bridge for Laravel 5 using the [PHP SDK for PayPal RESTful APIs Package](https://github.com/paypal/PayPal-PHP-SDK).This package is inspired by [https://github.com/vinkla/vimeo](https://github.com/vinkla/vimeo).\n\n## Installation\nRequire this package, with [Composer](https://getcomposer.org/), in the root directory of your project.\n\n```bash\ncomposer require sger/laravel-paypal\n```\n\nAdd the service provider to `config/app.php` in the `providers` array.\n\n```php\nSger\\Paypal\\PaypalServiceProvider::class\n```\n\n```php\n'Paypal' =\u003e Sger\\Paypal\\Facades\\Paypal::class\n```\n\n## Configuration\n\n```bash\nphp artisan vendor:publish\n```\n\nThis will create a `config/paypal.php` file in your app which contains two types of connection 'sandbox' and 'live'.\n\n## Usage\n\nIn your routes.php create for example:\n\n```php\nRoute::resource('payments', 'PaymentsController');\n```\n\nnext in your controller in your store method add the following code:\n\n```php\n$payer = new Payer;\n$payer-\u003esetPaymentMethod(\"paypal\");\n\n$item1 = new Item();\n$item1-\u003esetName('test')\n\t-\u003esetCurrency('EUR')\n\t-\u003esetQuantity(1)\n\t-\u003esetPrice(10);\n\n$itemList = new ItemList();\n$itemList-\u003esetItems(array($item1));\n\n$amount = new Amount();\n$amount-\u003esetCurrency('EUR')\n\t-\u003esetTotal(10);\n\n$transaction = new Transaction();\n$transaction-\u003esetAmount($amount)\n\t-\u003esetItemList($itemList)\n\t-\u003esetDescription(\"Payment description\")\n\t-\u003esetInvoiceNumber(uniqid());\n\n$baseUrl = \\URL::to('/');\n\n$redirectUrls = new RedirectUrls();\n$redirectUrls-\u003esetReturnUrl(\"$baseUrl/execute-payment?success=true\")\n-\u003esetCancelUrl(\"$baseUrl/execute-payment?success=false\");\n\n$payment = new Payment();\n\n$payment-\u003esetIntent(\"sale\")\n\t-\u003esetPayer($payer)\n\t-\u003esetRedirectUrls($redirectUrls)\n\t-\u003esetTransactions(array($transaction));\n\ntry {\n\t$payment-\u003ecreate(\\Paypal::connection('sandbox'));\n} catch (\\PPConnectionException $ex) {\n\treturn  \"Exception: \" . $ex-\u003egetMessage() . PHP_EOL;\n\texit(1);\n}\n\n$approvalUrl = $payment-\u003egetApprovalLink();\n// redirect user to the $approvalUrl\n```\n\n## License\n\nLaravel Paypal is licensed under [The MIT License (MIT)](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsger%2Flaravel-paypal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsger%2Flaravel-paypal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsger%2Flaravel-paypal/lists"}