PHPackages                             overtrue/laravel-payment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. overtrue/laravel-payment

ActiveLibrary[Payment Processing](/categories/payments)

overtrue/laravel-payment
========================

Omnipay ServiceProvider for Laravel.

3.0.0(5y ago)914.2k17MITPHPPHP &gt;=7.0CI failing

Since Mar 31Pushed 5y ago3 watchersCompare

[ Source](https://github.com/overtrue/laravel-payment)[ Packagist](https://packagist.org/packages/overtrue/laravel-payment)[ RSS](/packages/overtrue-laravel-payment/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (6)Versions (10)Used By (0)

Laravel Payment
===============

[](#laravel-payment)

💳 [Omnipay](https://github.com/thephpleague/omnipay) ServiceProvider for Laravel.

[![Build Status](https://camo.githubusercontent.com/e0a7c99bf625826729596ed42c80f957cee99b3da782ebc44450a5264433590f/68747470733a2f2f7472617669732d63692e6f72672f6f766572747275652f6c61726176656c2d7061796d656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/overtrue/laravel-payment)[![Latest Stable Version](https://camo.githubusercontent.com/e769fff52b2b63f2723fd48818f92420ad42e7c2def4c70922d4289e643a3aad/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d7061796d656e742f762f737461626c65)](https://packagist.org/packages/overtrue/laravel-payment)[![Total Downloads](https://camo.githubusercontent.com/a56cc42d9b4528dfa49b8858cc87cc6e19ec65763618b135b9c4b22001373bd0/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d7061796d656e742f646f776e6c6f616473)](https://packagist.org/packages/overtrue/laravel-payment)[![License](https://camo.githubusercontent.com/f852a9c9bd25bd75586ff0ba27116eeb229cd67ce1724c7ea329cdd82dbd785a/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d7061796d656e742f6c6963656e7365)](https://packagist.org/packages/overtrue/laravel-payment)[![composer.lock](https://camo.githubusercontent.com/e73978b58f24d3fd8d36cc0cfc0f7f550a72bd5fae3f0258fd6a4a5be302f960/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d7061796d656e742f636f6d706f7365726c6f636b)](https://packagist.org/packages/overtrue/laravel-payment)

Installing
----------

[](#installing)

```
$ composer require overtrue/laravel-payment -v
```

After updated composer, if you are using laravel version &lt; 5.5, you need to register service provider:

```
// config/app.php

    'providers' => [
        //...
        Overtrue\LaravelPayment\ServiceProvider::class,
    ],
```

And publish the config file:

```
$ php artisan vendor:publish --provider=Overtrue\\LaravelPayment\\ServiceProvider
```

if you want to use facade mode, you can register a facade name what you want to use, for example `LaravelPayment`:

```
// config/app.php

    'aliases' => [
        'LaravelPayment' => Overtrue\LaravelPayment\Facade::class, // This is default in laravel 5.5
    ],
```

### configuration

[](#configuration)

```
// config/payments.php

    // The default gateway name which configured in `gateways` section.
    'default_gateway' => 'paypal',

    // The default options for every gateways.
    'default_options' => [
        'test_mode' => true,
        // ...
    ],

    /*
     * The gateways, you can config option by camel case or snake_case name.
     *
     * the option name is followed from gateway class, for example:
     *
     * $gateway->setMchId('overtrue');
     *
     * you can configured as:
     *  'mch_id' => 'overtrue',
     * or:
     *  'mchId' => 'overtrue',
     */
    'gateways' => [
        'paypal' => [
            'driver' => 'PayPal_Express',
            'options' => [
                'username' => env('PAYPAL_USERNAME'),
                'password' => env('PAYPAL_PASSWORD'),
                'signature' => env('PAYPAL_SIGNATURE'),
                'test_mode' => env('PAYPAL_TEST_MODE'),
            ],
        ],
        // other gateways
    ],
```

### install payment gateways

[](#install-payment-gateways)

You need to install the gateway you want to use: [omnipay#payment-gateways](https://github.com/thephpleague/omnipay#payment-gateways)

Usage
-----

[](#usage)

Gateway instance:

```
LaravelPayment::gateway('GATEWAY NAME'); // GATEWAY NAME is key name of `gateways` configuration.
LaravelPayment::gateway('alipay');
LaravelPayment::gateway('paypal');
```

Using default gateway:

```
LaravelPayment::purchase(...);
```

Example:

```
$formData = [
    'number' => '4242424242424242',
    'expiryMonth' => '6',
    'expiryYear' => '2030',
    'cvv' => '123'
];

$response = LaravelPayment::purchase([
    'amount' => '10.00',
    'currency' => 'USD',
    'card' => $formData,
))->send();

if ($response->isRedirect()) {
    // redirect to offsite payment gateway
    $response->redirect();
} elseif ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}
```

For more use about [Omnipay](https://github.com/omnipay/omnipay), please refer to [Omnipay Official Home Page](http://omnipay.thephpleague.com/)

PHP 扩展包开发
---------

[](#php-扩展包开发)

> 想知道如何从零开始构建 PHP 扩展包？
>
> 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)

License
-------

[](#license)

MIT

###  Health Score

37

↑

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 77.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~139 days

Recently: every ~187 days

Total

8

Last Release

1989d ago

Major Versions

1.0.7 → 2.0.02020-10-16

2.0.0 → 3.0.02020-12-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/c507e57eab402e81335012357b7d7df6c5cafda3073adcc94b475037127d263f?d=identicon)[overtrue](/maintainers/overtrue)

---

Top Contributors

[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (27 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (3 commits)")[![makroxyz](https://avatars.githubusercontent.com/u/2069949?v=4)](https://github.com/makroxyz "makroxyz (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![shirone](https://avatars.githubusercontent.com/u/4187197?v=4)](https://github.com/shirone "shirone (1 commits)")[![summerblue](https://avatars.githubusercontent.com/u/324764?v=4)](https://github.com/summerblue "summerblue (1 commits)")[![sunl888](https://avatars.githubusercontent.com/u/9254545?v=4)](https://github.com/sunl888 "sunl888 (1 commits)")

---

Tags

alipaylaravelomnipaypayment-gatewaywechatwechat-pay

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/overtrue-laravel-payment/health.svg)

```
[![Health](https://phpackages.com/badges/overtrue-laravel-payment/health.svg)](https://phpackages.com/packages/overtrue-laravel-payment)
```

###  Alternatives

[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[tsaiyihua/laravel-ecpay

ecpay library for laravel

6416.3k](/packages/tsaiyihua-laravel-ecpay)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

322.8k](/packages/duncanmcclean-statamic-cargo)[wandesnet/mercadopago-laravel

PHP SDK for integration with Mercado Pago

252.4k](/packages/wandesnet-mercadopago-laravel)[tsaiyihua/laravel-linepay

linepay library for laravel

102.9k](/packages/tsaiyihua-laravel-linepay)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
