PHPackages                             aimandaniel/toyyibpay - 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. [API Development](/categories/api)
4. /
5. aimandaniel/toyyibpay

ActiveLibrary[API Development](/categories/api)

aimandaniel/toyyibpay
=====================

Framework-agnostic PHP library for toyyibPay API (unofficial)

5266[1 issues](https://github.com/xputerax/toyyibpay/issues)[2 PRs](https://github.com/xputerax/toyyibpay/pulls)PHP

Since Jun 24Pushed 3y agoCompare

[ Source](https://github.com/xputerax/toyyibpay)[ Packagist](https://packagist.org/packages/aimandaniel/toyyibpay)[ RSS](/packages/aimandaniel-toyyibpay/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

PHP ToyyibPay Library (unofficial)
==================================

[](#php-toyyibpay-library-unofficial)

Unofficial PHP library for toyyibPay payment gateway. This package is heavily inspired by [jomweb/billplz](https://github.com/jomweb/billplz). Please consult the [official API reference](https://toyyibpay.com/apireference/) for a detailed explanation.

- [Installation](#installation)
- [Getting started](#getting-started)
    - [Creating a client](#creating-a-client)
    - [Using sandbox mode](#using-sandbox-mode)
- [Usage](#usage)
    - [Bank](#bank)
        - [Get bank list](#get-bank-list)
        - [Get bank FPX codes](#get-bank-fpx-codes)
    - [Package](#package)
        - [Get package list](#get-package-list)
    - [User](#user)
        - [Create user](#create-user)
        - [Get user status](#get-user-status)
        - [Get all user](#get-all-user)
    - [Category](#category)
        - [Create category](#create-category)
        - [Get category](#get-category)
    - [Bill](#bill)
        - [Create a bill](#create-a-bill)
        - [Create a multi-payment bill](#create-amulti-payment-bill)
        - [Run bill](#run-bill)
        - [Get all bills](#get-all-bills)
        - [Get bill transactions](#get-bill-transactions)
    - [Settlement](#settlement)
        - [Get all settlement](#get-all-settlement)
        - [Get settlement summary](#get-settlement-summary)
- [Contribution](#contribution)
- [Developer's Note](#developers-note)
- [License](#license)

Installation
------------

[](#installation)

```
$ composer require aimandaniel/toyyibpay

```

Getting started
---------------

[](#getting-started)

### Creating a client

[](#creating-a-client)

```
use AimanDaniel\ToyyibPay\Client;

$client = Client::make('your-secret-key', 'your-category-code');
```

You can also pass a HTTP client directly:

```
use AimanDaniel\ToyyibPay\Client;

$http = Laravie\Codex\Discovery::client();

$client = new Client($http, 'your-secret-key', 'your-category-code');
```

### Using sandbox mode

[](#using-sandbox-mode)

You can enable sandbox environment by adding the following line:

```
$client->useSandbox();
```

Usage
-----

[](#usage)

### Bank

[](#bank)

You can create a `Bank` instance as follows:

```
$bank = $client->bank();
// or
$bank = $client->uses('Bank');
```

> You can pass the API version manually by doing `$client->bank('v1')` or `$client->uses('Bank', 'v1')` but currently the API only has one version and it is set as the default one

#### Get bank list

[](#get-bank-list)

```
$response = $bank->all();

var_dump($response->toArray());
```

#### Get bank FPX codes

[](#get-bank-fpx-codes)

```
$response = $bank->fpx();

var_dump($response->toArray());
```

### Package

[](#package)

Create a `Package` instance:

```
$package = $client->package();
// or
$package = $client->uses('Package');
```

#### Get package list

[](#get-package-list)

```
$response = $package->all();

var_dump($response->toArray());
```

### User

[](#user)

Create a `User` instance:

```
$user = $client->user();
// or
$user = $client->uses('User');
```

#### Create User

[](#create-user)

```
$response = $user->create(
  string $fullname,
  string $username,
  string $email,
  string $password,
  string $phone,
  int $bank, // same id as in $bank->all()
  string $accountNo, // bank acc number
  string $accountHolderName, // bank acc holder
  ?string $registrationNo,
  ?int $package,
  ?int $userStatus
);

var_dump($response->toArray());
```

#### Get user status

[](#get-user-status)

```
$response = $user->status($username);

var_dump($response->toArray());
```

#### Get all user

[](#get-all-user)

```
$partnerType = 'OEM'; // or 'ENTERPRISE', defaults to OEM if null

$response = $user->all($partnerType);

var_dump($response->toArray());
```

### Category

[](#category)

Create a `Category` instance as follows:

```
$category = $client->category();
// or
$category = $client->uses('Category');
```

#### Create category

[](#create-category)

```
$response = $category->create(
  string $categoryName,
  string $categoryDescription
);

var_dump($response->toArray());
```

#### Get category

[](#get-category)

```
$response = $category->get('category code');

var_dump($response->toArray());
```

### Bill

[](#bill)

Create a `Bill` instance:

```
$bill = $client->bill();
// or
$bill = $client->uses('Bill');
```

#### Create a bill

[](#create-a-bill)

```
$response = $bill->create(
  string $billName,
  string $billDescription,
  int $billPriceSetting,
  int $billPayerInfo,
  string $billAmount,
  string $billReturnUrl,
  string $billCallbackUrl,
  string $billExternalReferenceNo,
  ?string $billTo,
  string $billEmail,
  string $billPhone,
  array $optionals = []
);

var_dump($response->toArray());
```

`$optionals` expects an associative array of any of these values:

KeyExpected ValueDefault ValuebillSplitPaymentBill::PAYMENT\_SPLIT (1)
 (empty)
(empty)billSplitPaymentArgsJSON String(empty)billPaymentChannelBill::PAYMENT\_CHANNEL\_FPX (0)
 Bill::PAYMENT\_CHANNEL\_CC (1)
 Bill::PAYMENT\_CHANNEL\_BOTH (2)
Bill::PAYMENT\_CHANNEL\_BOTH (2)billDisplayMerchantBill::MERCHANT\_HIDE (0)
 Bill::MERCHANT\_DISPLAY (1)
Bill::MERCHANT\_DISPLAY (1)billContentEmail(string)(empty)billChargeToCustomerBill::CHARGE\_OWNER\_BOTH (null)
 Bill::CHARGE\_FPX\_CUSTOMER\_CC\_OWNER (0)
 Bill::CHARGE\_FPX\_OWNER\_CC\_CUSTOMER (1)
 Bill::CHARGE\_CUSTOMER\_BOTH (2)
Bill::CHARGE\_OWNER\_BOTH (null)#### Create a multi-payment bill

[](#create-a-multi-payment-bill)

```
$response = $bill->createMultiPayment(
  string $billName,
  string $billDescription,
  string $billPriceSetting,
  string $billPayerInfo,
  string $billAmount,
  string $billReturnUrl,
  string $billCallbackUrl,
  string $billExternalReferenceNo,
  string $billTo,
  string $billEmail,
  string $billPhone,
  string $billSplitPayment,
  string $billSplitPaymentArgs,
  string $billMultiPayment,
  string $billPaymentChannel,
  string $billDisplayMerchant,
  string $billContentEmail
);

var_dump($response->toArray());
```

#### Run bill

[](#run-bill)

```
$response = $bill->run(
  string $billCode,
  string $billpaymentAmount,
  string $billpaymentPayerName,
  string $billpaymentPayerPhone,
  string $billpaymentPayerEmail,
  string $billBankID
);

var_dump($response->toArray());
```

#### Get all bills

[](#get-all-bills)

```
$partnerType = 'OEM'; // or 'ENTERPRISE'
$yearMonth = '2020-01';

$response = $bill->all(
  string $partnerType,
  ?string $yearMonth = null
);

var_dump($response->toArray());
```

#### Get bill transactions

[](#get-bill-transactions)

```
$response = $bill->transactions(
  string $billCode,
  ?int $billpaymentStatus = 1
);

var_dump($response->toArray());
```

### Settlement

[](#settlement)

Create a `Settlement` instance:

```
$settlement = $client->settlement();
// or
$settlement = $client->uses('settlement');
```

#### Get all settlement

[](#get-all-settlement)

```
$response = $settlement->all(
  string $partnerType,
  bool $groupByUsername
);

var_dump($response->toArray());
```

#### Get settlement summary

[](#get-settlement-summary)

```
$response = $settlement->summary(
  string $partnerType,
  bool $groupByUsername
);

var_dump($response->toArray());
```

Contribution
------------

[](#contribution)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Developer's Note
----------------

[](#developers-note)

The API version declared in this package is v1 even though the official [API reference](https://toyyibpay.com/apireference/) does not explicitly declare it as such

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85% 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/de8d8970d88832f2ba2687f3500952058d27911a8e924bba8e8197e5c147374d?d=identicon)[ad42069](/maintainers/ad42069)

---

Top Contributors

[![xputerax](https://avatars.githubusercontent.com/u/24550890?v=4)](https://github.com/xputerax "xputerax (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![adimixx](https://avatars.githubusercontent.com/u/55822165?v=4)](https://github.com/adimixx "adimixx (1 commits)")

### Embed Badge

![Health badge](/badges/aimandaniel-toyyibpay/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k14](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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