PHPackages                             flamelin/ecpay - 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. flamelin/ecpay

ActiveEctool[Payment Processing](/categories/payments)

flamelin/ecpay
==============

ECPay for Laravel 5

421.3k↓39.6%11[3 PRs](https://github.com/flamelin/ECPay/pulls)PHP

Since May 24Pushed 7y ago2 watchersCompare

[ Source](https://github.com/flamelin/ECPay)[ Packagist](https://packagist.org/packages/flamelin/ecpay)[ RSS](/packages/flamelin-ecpay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Ecpay
-----

[](#ecpay)

### Ecpay - Laravel 5 version

[](#ecpay---laravel-5-version)

**step 1 : Download the package**
composer命令安裝

```
composer require flamelin/ecpay dev-master

```

或者是新增package至composer.json

```
"require": {
  "flamelin/ecpay": "dev-master"
},

```

然後更新安裝

```
composer update

```

或全新安裝

```
composer install

```

\*\*step 2 : Modify config file\*\*
增加`config/app.php`中的`providers`和`aliases`的參數 ``` 'providers' =&gt; \[ // ... flamelin\\ECPay\\EcpayServiceProvider::class, \] 'aliases' =&gt; \[ // ... 'Ecpay' =&gt; flamelin\\ECPay\\Facade\\Ecpay::class, \]

```

**step 3 : Publish config to your project**
執行下列命令，將package的config檔配置到你的專案中

```

php artisan vendor:publish

```

可至config/ecpay.php中查看
預設是測試Ecpay設定
```php
return [
    'ServiceURL' => env('PAY_SERVICE_URL', 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V2'),
    'HashKey' => env('PAY_HASH_KEY', '5294y06JbISpM5x9'),
    'HashIV' => env('PAY_HASH_IV', 'v77hoKGq4kWxNNIS'),
    'MerchantID' => env('PAY_MERCHANT_ID', '2000132'),
];

```

\*\*step 4 : .env中新增參數\*\*
```ini #付款測試 true : 直接使用測試的特店參數, false : 使用config/ecpay.php中的參數. APP\_PAY\_TEST=true PAY\_SERVICE\_URL=PAY\_HASH\_KEY=5294y06JbISpM5x9 PAY\_HASH\_IV=v77hoKGq4kWxNNIS PAY\_MERCHANT\_ID=2000132

```

---

### How To Use
```php
use Ecpay;

```

```
public function Demo()
{
    //Official Example :
    //https://github.com/ECPay/ECPayAIO_PHP/blob/master/AioSDK/example/sample_Credit_CreateOrder.php

    //基本參數(請依系統規劃自行調整)
    Ecpay::i()->Send['ReturnURL']         = "http://www.ecpay.com.tw/receive.php" ;
    Ecpay::i()->Send['MerchantTradeNo']   = "Test".time() ;           //訂單編號
    Ecpay::i()->Send['MerchantTradeDate'] = date('Y/m/d H:i:s');      //交易時間
    Ecpay::i()->Send['TotalAmount']       = 2000;                     //交易金額
    Ecpay::i()->Send['TradeDesc']         = "good to drink" ;         //交易描述
    Ecpay::i()->Send['ChoosePayment']     = \ECPay_PaymentMethod::ALL ;     //付款方式

    //訂單的商品資料
    array_push(Ecpay::i()->Send['Items'], array('Name' => "緑界黑芝麻豆漿", 'Price' => (int)"2000",
               'Currency' => "元", 'Quantity' => (int) "1", 'URL' => "dedwed"));

    //Go to ECPay
    echo "緑界頁面導向中...";
    echo Ecpay::i()->CheckOutString();
}
```

用laravel的人開發盡量使用`CheckOutString()`回傳String的方法
當然使用`CheckOut()`也是可以
但如果使用的話，我猜後面可能會碰到Get不到特定Session的問題

```
//付款成功後緑界背景callback
public function doneDemo(Request $request)
{
    $arFeedback = Ecpay::i()->CheckOutFeedback($request->all());
    print Ecpay::i()->getResponse($arFeedback);
}
```

--- ### Example (Localhost)

[](#example-localhost)

Example Link : [http://localhost/\[your-project\]/public/ecpay\_demo\_201702](http://localhost/%5Byour-project%5D/public/ecpay_demo_201702)

---

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.8% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/06210cc586acf9e52e564fc414e46bc1698e476eca4002fcbc7409bf7ae82533?d=identicon)[flamelin](/maintainers/flamelin)

---

Top Contributors

[![tinghom](https://avatars.githubusercontent.com/u/16273308?v=4)](https://github.com/tinghom "tinghom (20 commits)")[![ScottChayaa](https://avatars.githubusercontent.com/u/11566262?v=4)](https://github.com/ScottChayaa "ScottChayaa (14 commits)")

### Embed Badge

![Health badge](/badges/flamelin-ecpay/health.svg)

```
[![Health](https://phpackages.com/badges/flamelin-ecpay/health.svg)](https://phpackages.com/packages/flamelin-ecpay)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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