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

AbandonedEctool

kevin50406418/ecpay
===================

Ecpay Laravel 5 version

026PHP

Since Dec 27Pushed 7y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Ecpay
-------------

[](#laravel-ecpay)

[![Latest Stable Version](https://camo.githubusercontent.com/6153b2845905503e27d0a870340e8fc1268d97e1a2276718f625229a793272a8/68747470733a2f2f706f7365722e707567782e6f72672f6b6576696e35303430363431382f65637061792f762f737461626c65)](https://packagist.org/packages/kevin50406418/ecpay)[![License](https://camo.githubusercontent.com/4f79e2b6eb08613fec3e81f7e2f008b6a012befcd0f33e41bade97777f08a623/68747470733a2f2f706f7365722e707567782e6f72672f6b6576696e35303430363431382f65637061792f6c6963656e7365)](https://packagist.org/packages/kevin50406418/ecpay)[![Latest Unstable Version](https://camo.githubusercontent.com/d6e2df90245d5de1d8ebfa59f45c0485bf66bdb181cd0459b7d4c0ae14e4cca6/68747470733a2f2f706f7365722e707567782e6f72672f6b6576696e35303430363431382f65637061792f762f756e737461626c65)](https://packagist.org/packages/kevin50406418/ecpay)[![Total Downloads](https://camo.githubusercontent.com/d14bfe2d5dad5b08d63754025b8db997f8d138f0c8242e7453863d5451fcb964/68747470733a2f2f706f7365722e707567782e6f72672f6b6576696e35303430363431382f65637061792f646f776e6c6f616473)](https://packagist.org/packages/kevin50406418/ecpay)[![Monthly Downloads](https://camo.githubusercontent.com/5cc2226dbbf22c586d87c988cd2e5d57b657e0cd90a89fd34bf6479c4077bb34/68747470733a2f2f706f7365722e707567782e6f72672f6b6576696e35303430363431382f65637061792f642f6d6f6e74686c79)](https://packagist.org/packages/kevin50406418/ecpay)

Laravel Ecpay 是 [綠界科技](https://www.ecpay.com.tw) 非官方套件

### Ecpay - Laravel 5 version

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

It is a fork from [ScottChayaa/Allpay](https://github.com/ScottChayaa/Allpay) package

#### Step 1 : 安裝套件

[](#step-1--安裝套件)

composer 命令安裝

```
composer require kevin50406418/ecpay

```

或者是新增 package 至 composer.json

```
"require": {
  "kevin50406418/ecpay": "^1.0.0"
},

```

然後更新安裝

```
composer update

```

或全新安裝

```
composer install

```

#### Step 2 : 註冊 ServiceProvider 和 Facade

[](#step-2--註冊-serviceprovider-和-facade)

增加 `config/app.php` 中的 `providers` 和 `aliases` 的參數，依需求加上 (Laravel 5.5 以上無須手動註冊)

```
'providers' => [
  // ...
  Kevin50406418\Ecpay\EcpayServiceProvider::class,
]

'aliases' => [
  // ...
  'Ecpay' => Kevin50406418\Ecpay\Facade\Ecpay::class,
]

```

#### Step 3 : 建立設定檔

[](#step-3--建立設定檔)

執行下列命令，將 package 的 config 檔配置到你的專案中

```
php artisan vendor:publish --provider=Kevin50406418\Ecpay\EcpayServiceProvider

```

可至 config/ecpay.php 中查看

預設是測試 Ecpay 設定

```
return [
    'ServiceURL' => 'http://payment-stage.allpay.com.tw/Cashier/AioCheckOut',
    'HashKey'    => '5294y06JbISpM5x9',
    'HashIV'     => 'v77hoKGq4kWxNNIS',
    'MerchantID' => '2000132',
];
```

#### Step 4 : 在 .env 中加入下列設定

[](#step-4--在-env-中加入下列設定)

[MerchantID及HashKey、HashIV的取得](https://www.ecpay.com.tw/CascadeFAQ/CascadeFAQ_Qa?nID=1179)

```
#Ecpay
ECPAY_TEST_MODE=false
ECPAY_SERVICE_URL=https://payment.ecpay.com.tw/Cashier/AioCheckOut/V5
ECPAY_HASH_KEY=
ECPAY_HASH_IV=
ECPAY_MERCHANT_ID=
ECPAY_ENCRYPT_TYPE=1

```

---

### 使用

[](#使用)

**產生訂單**

```
use Ecpay;
```

```
public function Demo()
{
    //Official Example :
    //https://github.com/ECPay/ECPayAIO_PHP/blob/master/AioSDK/example/sample_All_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 ;    //付款方式

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

    //導向綠界
    return Ecpay::i()->CheckOutString();
}
```

**付款結果通知**

```
public function PayReturn(Request $request)
{
    /* 取得回傳參數 */
    $arFeedback = Ecpay::i()->CheckOutFeedback($request->all());
    //...
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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/1ed4d025445545a2c1e1a7397f80aca1459f82b85e100f784a3109f3b60dfa8f?d=identicon)[kevin50406418](/maintainers/kevin50406418)

---

Top Contributors

[![kevin50406418](https://avatars.githubusercontent.com/u/5019056?v=4)](https://github.com/kevin50406418 "kevin50406418 (14 commits)")

### Embed Badge

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

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

PHPackages © 2026

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