PHPackages                             scottchayaa/allpay - 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. scottchayaa/allpay

ActiveEctool[Payment Processing](/categories/payments)

scottchayaa/allpay
==================

Allpay - Laravel 5 version

1.0(9y ago)1353518PHP

Since Aug 13Pushed 8y ago2 watchersCompare

[ Source](https://github.com/ScottChayaa/Allpay)[ Packagist](https://packagist.org/packages/scottchayaa/allpay)[ RSS](/packages/scottchayaa-allpay/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Allpay - Laravel 5 version
--------------------------

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

### step 1 : Download the package

[](#step-1--download-the-package)

composer命令安裝

```
composer require scottchayaa/allpay dev-master

```

或者是新增package至composer.json

```
"require": {
  "scottchayaa/allpay": "dev-master"
},

```

然後更新安裝

```
composer update

```

或全新安裝

```
composer install

```

### step 2 : Modify config file

[](#step-2--modify-config-file)

增加`config/app.php`中的`providers`和`aliases`的參數

```
'providers' => [
  // ...
  ScottChayaa\Allpay\AllpayServiceProvider::class,
]

'aliases' => [
  // ...
  'Allpay' => ScottChayaa\Allpay\Facade\Allpay::class,
]

```

### step 3 : Publish config to your project

[](#step-3--publish-config-to-your-project)

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

```
php artisan vendor:publish

```

可至config/allpay.php中查看
預設是Allpay的測試環境設定

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

---

### How To Use

[](#how-to-use)

```
use Allpay;

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

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

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

    //Go to AllPay
    echo "歐付寶頁面導向中...";
    echo Allpay::i()->CheckOutString();
}
```

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

PS : PaymentMethod前面一定要加反斜線 \\ → 這目前我也沒辦法，如果有人知道怎麼樣可以不用加，請告訴我
You Need to add Backslash '' before PaymentMethod → I have no idea how to take it off. If someone know how to remove, please tell me how to do. thx~

---

### Example (Localhost)

[](#example-localhost)

Example Link : [http://localhost/\[your-project\]/public/allpay\_demo\_201608](http://localhost/%5Byour-project%5D/public/allpay_demo_201608)

---

### Bug Fix Record

[](#bug-fix-record)

AllPay.Payment.Integration.php : (Latest commit e9278b9)

#### 1) 修正 CheckOutString

[](#1-修正-checkoutstring)

原檔

```
static function CheckOutString($paymentButton,$target = "_self",$arParameters = array(),$arExtend = array(),$HashKey='',$HashIV='',$ServiceURL=''){

    $arParameters = self::process($arParameters,$arExtend);
    //產生檢查碼
    $szCheckMacValue = CheckMacValue::generate($arParameters,$HashKey,$HashIV,$arParameters['EncryptType']);

    $szHtml =  '';
    $szHtml .= '';
    $szHtml .=     '';
    $szHtml .=         '';
    $szHtml .=     '';
    $szHtml .=     '';
    $szHtml .=         "";
    foreach ($arParameters as $keys => $value) {
        $szHtml .=         "";
    }
    $szHtml .=             "";
    $szHtml .=             "";
    $szHtml .=         '';
    $szHtml .=     '';
    $szHtml .= '';
    return  $szHtml ;
}
```

修正為

```
static function CheckOutString($paymentButton,$target = "_self",$arParameters = array(),$arExtend = array(),$HashKey='',$HashIV='',$ServiceURL=''){

    $arParameters = self::process($arParameters,$arExtend);
    //產生檢查碼
    $szCheckMacValue = CheckMacValue::generate($arParameters,$HashKey,$HashIV,$arParameters['EncryptType']);

    $szHtml =  '';
    $szHtml .= '';
    $szHtml .=     '';
    $szHtml .=         '';
    $szHtml .=     '';
    $szHtml .=     '';
    $szHtml .=         "";

    foreach ($arParameters as $keys => $value) {
        $szHtml .=         "";
    }

    $szHtml .=             "";
    if (!isset($paymentButton)) {
        $szHtml .=  'document.getElementById("__allpayForm").submit();';
    }
    else{
        $szHtml .=  "";
    }
    $szHtml .=         '';
    $szHtml .=     '';
    $szHtml .= '';
    return  $szHtml ;
}
```

主要是針對`$paymentButton`去做調整
如果有比較現在版本跟以前版本的人會發現這個錯誤
缺少`if (!isset($paymentButton))`的判斷
如果官方的工程師有發現這個問題就趕快解吧

#### 2) 修正CheckOutFeedback

[](#2-修正checkoutfeedback)

原檔

```
function CheckOutFeedback() {
    return $arFeedback = CheckOutFeedback::CheckOut($_POST,$this->HashKey,$this->HashIV,0);
}
```

修正為

```
function CheckOutFeedback($allPost = null) {
    if($allPost == null) $allPost = $_POST;
    return $arFeedback = CheckOutFeedback::CheckOut($allPost,$this->HashKey,$this->HashIV,0);
}
```

歐付寶回傳頁面時會使用到這個方法
使用方法 ex:

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

注意要傳入`$request->all()`
因為官方原本的方法是帶入`$_POST` → Laravel 5 不鳥你這個，所以會出錯
固做此修正
不過這部分沒有多做說明，留給大家試試看

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3566d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/36c32a38315dc66ff049bf5e62d2e29d06b442c911bb5e0fd1ab437275bfd09a?d=identicon)[ScottChayaa](/maintainers/ScottChayaa)

---

Top Contributors

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

---

Tags

allpay

### Embed Badge

![Health badge](/badges/scottchayaa-allpay/health.svg)

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

###  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/braintree

Braintree gateway for Omnipay payment processing library

35558.0k3](/packages/omnipay-braintree)

PHPackages © 2026

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