{"id":17922684,"url":"https://github.com/overtrue/laravel-payment","last_synced_at":"2025-04-13T06:27:52.619Z","repository":{"id":52437543,"uuid":"103515026","full_name":"overtrue/laravel-payment","owner":"overtrue","description":"Omnipay ServiceProvider for Laravel.","archived":false,"fork":false,"pushed_at":"2021-04-29T07:25:26.000Z","size":34,"stargazers_count":92,"open_issues_count":0,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T23:55:26.352Z","etag":null,"topics":["alipay","laravel","omnipay","payment-gateway","wechat","wechat-pay"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/overtrue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-14T09:41:30.000Z","updated_at":"2025-02-28T08:04:54.000Z","dependencies_parsed_at":"2022-08-23T20:50:47.038Z","dependency_job_id":null,"html_url":"https://github.com/overtrue/laravel-payment","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-payment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-payment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-payment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Flaravel-payment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/overtrue","download_url":"https://codeload.github.com/overtrue/laravel-payment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248673534,"owners_count":21143513,"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":["alipay","laravel","omnipay","payment-gateway","wechat","wechat-pay"],"created_at":"2024-10-28T20:40:26.669Z","updated_at":"2025-04-13T06:27:52.588Z","avatar_url":"https://github.com/overtrue.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Payment\n\n:credit_card: [Omnipay](https://github.com/thephpleague/omnipay) ServiceProvider for Laravel.\n\n[![Build Status](https://travis-ci.org/overtrue/laravel-payment.svg?branch=master)](https://travis-ci.org/overtrue/laravel-payment)\n[![Latest Stable Version](https://poser.pugx.org/overtrue/laravel-payment/v/stable)](https://packagist.org/packages/overtrue/laravel-payment)\n[![Total Downloads](https://poser.pugx.org/overtrue/laravel-payment/downloads)](https://packagist.org/packages/overtrue/laravel-payment)\n[![License](https://poser.pugx.org/overtrue/laravel-payment/license)](https://packagist.org/packages/overtrue/laravel-payment)\n[![composer.lock](https://poser.pugx.org/overtrue/laravel-payment/composerlock)](https://packagist.org/packages/overtrue/laravel-payment)\n\n## Installing\n\n```shell\n$ composer require overtrue/laravel-payment -v\n```\n\nAfter updated composer, if you are using laravel version \u003c 5.5, you need to register service provider: \n\n```php\n// config/app.php\n\n    'providers' =\u003e [\n        //...\n        Overtrue\\LaravelPayment\\ServiceProvider::class,\n    ],\n```\n\nAnd publish the config file: \n\n```shell\n$ php artisan vendor:publish --provider=Overtrue\\\\LaravelPayment\\\\ServiceProvider\n```\n\nif you want to use facade mode, you can register a facade name what you want to use, for example `LaravelPayment`:\n\n```php\n// config/app.php\n\n    'aliases' =\u003e [\n        'LaravelPayment' =\u003e Overtrue\\LaravelPayment\\Facade::class, // This is default in laravel 5.5\n    ],\n```\n\n### configuration \n\n```php\n// config/payments.php\n\n    // The default gateway name which configured in `gateways` section.\n    'default_gateway' =\u003e 'paypal',\n\n    // The default options for every gateways.\n    'default_options' =\u003e [\n        'test_mode' =\u003e true,\n        // ...\n    ],\n\n    /*\n     * The gateways, you can config option by camel case or snake_case name.\n     *\n     * the option name is followed from gateway class, for example:\n     *\n     * $gateway-\u003esetMchId('overtrue');\n     *\n     * you can configured as:\n     *  'mch_id' =\u003e 'overtrue',\n     * or:\n     *  'mchId' =\u003e 'overtrue',\n     */\n    'gateways' =\u003e [\n        'paypal' =\u003e [\n            'driver' =\u003e 'PayPal_Express',\n            'options' =\u003e [\n                'username' =\u003e env('PAYPAL_USERNAME'),\n                'password' =\u003e env('PAYPAL_PASSWORD'),\n                'signature' =\u003e env('PAYPAL_SIGNATURE'),\n                'test_mode' =\u003e env('PAYPAL_TEST_MODE'),\n            ],\n        ],\n        // other gateways\n    ],\n```\n\n### install payment gateways\n\nYou need to install the gateway you want to use: [omnipay#payment-gateways](https://github.com/thephpleague/omnipay#payment-gateways)\n\n## Usage\n\nGateway instance:\n\n```php\nLaravelPayment::gateway('GATEWAY NAME'); // GATEWAY NAME is key name of `gateways` configuration.\nLaravelPayment::gateway('alipay');\nLaravelPayment::gateway('paypal');\n```\n\nUsing default gateway:\n\n```php\nLaravelPayment::purchase(...);\n```\n\nExample:\n\n```php\n$formData = [\n    'number' =\u003e '4242424242424242', \n    'expiryMonth' =\u003e '6', \n    'expiryYear' =\u003e '2030', \n    'cvv' =\u003e '123'\n];\n\n$response = LaravelPayment::purchase([\n    'amount' =\u003e '10.00', \n    'currency' =\u003e 'USD', \n    'card' =\u003e $formData,\n))-\u003esend();\n\nif ($response-\u003eisRedirect()) {\n    // redirect to offsite payment gateway\n    $response-\u003eredirect();\n} elseif ($response-\u003eisSuccessful()) {\n    // payment was successful: update database\n    print_r($response);\n} else {\n    // payment failed: display message to customer\n    echo $response-\u003egetMessage();\n}\n```\n\nFor more use about [Omnipay](https://github.com/omnipay/omnipay), please refer to [Omnipay Official Home Page](http://omnipay.thephpleague.com/)\n\n## PHP 扩展包开发\n\n\u003e 想知道如何从零开始构建 PHP 扩展包？\n\u003e\n\u003e 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Flaravel-payment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovertrue%2Flaravel-payment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Flaravel-payment/lists"}