PHPackages                             terrylinooo/sinopac-php-sdk - 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. terrylinooo/sinopac-php-sdk

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

terrylinooo/sinopac-php-sdk
===========================

SinoPac Bank SDK for PHP.

0.2.1(2y ago)4501GPL-3.0-or-laterPHPPHP &gt;=7.1.0

Since Oct 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/terrylinooo/sinopac-php-sdk)[ Packagist](https://packagist.org/packages/terrylinooo/sinopac-php-sdk)[ Docs](https://github.com/terrylinooo/sinopac-php-sdk)[ RSS](/packages/terrylinooo-sinopac-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (1)

永豐金 Sinopac PHP SDK
===================

[](#永豐金-sinopac-php-sdk)

[![Build Status](https://camo.githubusercontent.com/1fc9a0a01ed8336b19a784a7e3cb045b81052c6c4d68923546bb0a5dee3a9e1a/68747470733a2f2f6170702e7472617669732d63692e636f6d2f74657272796c696e6f6f6f2f73696e6f7061632d7068702d73646b2e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/terrylinooo/sinopac-php-sdk)

Notice:

Starting from the end of April 2023, the Sinopac API requires the `X-KeyId` to be set in the header for authorization.

Examples
--------

[](#examples)

### Initialize QPay instance

[](#initialize-qpay-instance)

```
$qpay = new \Sinopac\QPay([
	'shop_no' => 'NA0249_001',
	'hash' => [
		'86D50DEF3EB7400E',
		'01FD27C09E5549E5',
		'9E004965F4244953',
		'7FB3385F414E4F91',
	],
    'key_id' => 'b5e6986d-8636-4aa0-8c93-441ad14b2098',
]);

// Method 2.

$qpay = new \Sinopac\QPay();
$qpay->setShopNo('NA0249_001');
$qpay->setKeyId('b5e6986d-8636-4aa0-8c93-441ad14b2098');
$qpay->setFirstHashPair('86D50DEF3EB7400E', '01FD27C09E5549E5');
$qpay->setSecondHashPair('9E004965F4244953', '7FB3385F414E4F91');

// Enabling sandbox mode will send API request to Sinopac's testing server.
$qpay->enableSandbox();
```

### Create order by virtual account (ATM)

[](#create-order-by-virtual-account-atm)

```
$data = [
    'shop_no'          => 'NA0249_001',
    'order_no'         => 'TEST0000001',
    'amount'           => 50000,
    'atm_expired_date' => '20210930',
    'product_name'     => '虛擬帳號訂單',
    'return_url'       => 'http://10.11.22.113:8803/QPay.ApiClient/Store/Return',
    'backend_url'      => 'http://10.11.22.113:8803/QPay.ApiClient/AutoPush/PushSuccess',
];

$results = $qpay->createOrderByATM($data);

if (!empty($results['Message'])) {
    print_r($results['Message']);
}
```

### Create order by credit card

[](#create-order-by-credit-card)

```
$data = [
    'shop_no'                 => 'NA0249_001',
    'order_no'                => 'TEST0000002',
    'amount'                  => 50000,
    'cc_auto_billing'         => 'N',
    'cc_expired_billing_days' => 7,
    'cc_expired_minutes'      => 10,
    'product_name'            => '信用卡訂單',
    'return_url'              => 'http://10.11.22.113:8803/QPay.ApiClient/Store/Return',
    'backend_url'             => 'http://10.11.22.113:8803/QPay.ApiClient/AutoPush/PushSuccess',
];

$results = $qpay->createOrderByCreditCard($data);

if (!empty($results['Message'])) {
    print_r($results['Message']);
}
```

### Query orders

[](#query-orders)

```
$data = [
    'pay_type'             => 'A',
    'order_datetime_begin' => '202109250110',
    'order_datetime_end'   => '202109262359'
];

$results = $qpay->queryOrders($data);

if (!empty($results['Message'])) {
    print_r($results['Message']);
}
```

### Query order status

[](#query-order-status)

```
$token = 'da1547c3d0d1649af5049125b0880c0e227f31e107cbf4f0995bed28d0f066c1';
$results = $qpay->queryOrderByToken($token);

if (!empty($results['Message'])) {
    print_r($results['Message']);
}
```

This PHP library was contributed by [Terry Lin](https://terryl.in) and [Colocal](https://colocal.com). It is licensed under the MIT License. Should you have any inquiries regarding this library, we kindly request you to open an issue and provide a detailed description of your question.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

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.

###  Release Activity

Cadence

Every ~194 days

Total

4

Last Release

1088d ago

### Community

Maintainers

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

---

Top Contributors

[![terrylinooo](https://avatars.githubusercontent.com/u/11989371?v=4)](https://github.com/terrylinooo "terrylinooo (33 commits)")

---

Tags

paymentq-pay

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/terrylinooo-sinopac-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/terrylinooo-sinopac-php-sdk/health.svg)](https://phpackages.com/packages/terrylinooo-sinopac-php-sdk)
```

###  Alternatives

[paymentsuite/stripe-bundle

Stripe PaymentSuite Component

105.0k](/packages/paymentsuite-stripe-bundle)

PHPackages © 2026

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