PHPackages                             rootwritter/tripay-payment-gateway - 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. rootwritter/tripay-payment-gateway

ActiveLibrary[Payment Processing](/categories/payments)

rootwritter/tripay-payment-gateway
==================================

PHP Payment Gateway Tripay Library

1.0.0(2y ago)05GPL-3.0PHP

Since May 13Pushed 2y agoCompare

[ Source](https://github.com/RootWritter/Tripay-Payment-Gateway)[ Packagist](https://packagist.org/packages/rootwritter/tripay-payment-gateway)[ Docs](https://payment.tripay.co.id)[ RSS](/packages/rootwritter-tripay-payment-gateway/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Un-official Tripay Payment Gateway
==================================

[](#un-official-tripay-payment-gateway)

[![Latest Stable Version](https://camo.githubusercontent.com/58b057ce31edcb8c711c8a4bde55d9f79aac1400cabc5acdbdb9efbca2dc2186/68747470733a2f2f706f7365722e707567782e6f72672f726f6f74777269747465722f7472697061792d7061796d656e742d676174657761792f76)](//packagist.org/packages/rootwritter/tripay-payment-gateway)[![Total Downloads](https://camo.githubusercontent.com/9a35ecbd9e4faeeeac00593f7a5fc96aa969a40808aaaeefb6658e55247e0c68/68747470733a2f2f706f7365722e707567782e6f72672f726f6f74777269747465722f7472697061792d7061796d656e742d676174657761792f646f776e6c6f616473)](//packagist.org/packages/rootwritter/tripay-payment-gateway)[![License](https://camo.githubusercontent.com/304c99f215e969579df010defa8546138575f4dff620f10ad07846c4259a37c8/68747470733a2f2f706f7365722e707567782e6f72672f726f6f74777269747465722f7472697061792d7061796d656e742d676174657761792f6c6963656e7365)](//packagist.org/packages/rootwritter/tripay-payment-gateway)

This package is un-official, already compatible with Composer, for more details please visit [Documentation](https://payment.tripay.co.id/developer). *This package is made to make it easier for php users*

IMPORTANT: Make sure you read the documentation and understand what these methods are used for!

need PHP 7 and above to use this package

Instalation
-----------

[](#instalation)

```
composer require rootwritter/tripay-payment-gateway

```

Configuration
-------------

[](#configuration)

before starting further, you must define or import a tripay for further configuration

```
use Tripay\Main;
```

then after that configure api-key, private-key, merchant-code

```
$main = new Main(
    'your-api-key',
    'your-private-key',
    'your-merchant-code',
    'sandbox' // fill for sandbox mode, leave blank if in production mode
);
```

For mode by default it will be in production mode, to change it to sandbox mode, you can add a 'sandbox' after the merchant code

Contents available
------------------

[](#contents-available)

content method available so far

MethodContentsStatus`initChannelPembayaran()``Channel Pembayaran`OK`initInstruksiPembayaran(string $code)``Instruksi Pembayaran`OK`initMerchantChannelPembayaran(string $code)``Merchant Channel Pembayaran`OK`initKalkulatorBiaya(string $code, int $amount)``Kalkulator Biaya`OK`initTransaction(string $merchantRef)``Transaksi Open/Close`OK`initCallback()``Callback`OKRequest available
-----------------

[](#request-available)

request can return the available content, the list of available methods is as follows

MethodDescription`getRequest(string $url)`return return guzzle http client`getResponse()`return response`getJson()`return json decode`getStatusCode()`return status code`getStatusCode()`return boolean`getData()`return data responseChannel Pembayaran
------------------

[](#channel-pembayaran)

This API is used to get a list of all available payment channels along with complete information including transaction fees for each channel

```
$main->initChannelPembayaran()
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

Instruksi Pembayaran
--------------------

[](#instruksi-pembayaran)

This API is used to retrieve payment instructions from each channel

```
$code = 'BRIVA'; //more info code, https://payment.tripay.co.id/developer
$init = $main->initInstruksiPembayaran($code)
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

Merchant Channel Pembayaran
---------------------------

[](#merchant-channel-pembayaran)

This API is used to obtain a list of payment channels available in your Merchant account along with complete information including transaction fees for each channel

```
$code = 'BRIVA'; //more info code, check your account
$init = $main->initMerchantChannelPembayaran($code);
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

Kalkulator Biaya
----------------

[](#kalkulator-biaya)

This API is used to obtain detailed transaction fee calculations for each channel based on a specified nominal

```
$code = 'BRIVA'; //more info code, https://payment.tripay.co.id/developer
$amount = 1000;//your amount
$init = $main->initKalkulatorBiaya($code, $amount);
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

Transaction
-----------

[](#transaction)

Before proceeding to the next step in transactions, please configure your reference merchant

```
$merchantRef = 'your-merchant-ref';//your merchant reference
$init = $main->initTransaction($merchantRef);
```

Before making a signature, please set the amount for close transactions and for open transactions, please set the payment method

```
$init->setAmount(1000); // for close payment
$init->setMethod('BRIVAOP'); // for open payment
```

Note: if you use an open payment do not define the amount and vice versa if you use a close payment do not define the amount

Create Signature
----------------

[](#create-signature)

```
$signature = $init->createSignature();
```

Close Transaction
-----------------

[](#close-transaction)

To define close transaction, use the `closeTransaction ()` method

```
$transaction = $init->closeTransaction(); // define your transaction type, for close transaction use `closeTransaction()`
```

After you define a close transaction, please set the payload with the `setPayload (array $ data)` method

\***\*examples:\*\***

```
$transaction->setPayload([
    'method'            => 'BRIVA', // IMPORTANT, dont fill by `getMethod()`!, for more code method you can check here https://payment.tripay.co.id/developer
    'merchant_ref'      => $merchantRef,
    'amount'            => $init->getAmount(),
    'customer_name'     => 'Nama Pelanggan',
    'customer_email'    => 'emailpelanggan@domain.com',
    'customer_phone'    => '081234567890',
    'order_items'       => [
        [
            'sku'       => 'PRODUK1',
            'name'      => 'Nama Produk 1',
            'price'     => $init->getAmount(),
            'quantity'  => 1
        ]
    ],
    'callback_url'      => 'https://domainanda.com/callback',
    'return_url'        => 'https://domainanda.com/redirect',
    'expired_time'      => (time()+(24*60*60)), // 24 jam
    'signature'         => $init->createSignature()
]); // set your payload, with more examples https://payment.tripay.co.id/developer
```

for get the payload u can use `getPayload()` method,

after set transaction u can sent the request and get data directly with the `getData () ` method or for more method u can seen in the [request method](#request-available) or can be see in examples

### Get Close Detail Transaction

[](#get-close-detail-transaction)

To see further transaction data, you can see it in transaction details, for close transactions, see below where to get reference code? please go to the simulator menu and get it in the transaction menu, there is a reference code that can be matched here

```
$referenceCode = 'your-reference-code'; // fill by reference code
$detail = $transaction->getDetail($referenceCode); // return get detail your transaction with your reference code
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

Open Transaction
----------------

[](#open-transaction)

To define close transaction, use the `openTransaction ()` method

```
$transaction = $init->openTransaction(); // define your transaction type, for close transaction use `openTransaction()`
```

After you define a open transaction, please set the payload with the `setPayload (array $ data)` method

\***\*examples:\*\***

```
$transaction->setPayload([
    'method'            => $this->getMethod(),
    'merchant_ref'      => $merchantRef,
    'customer_name'     => 'Nama Pelanggan',
    'signature'         => $init->createSignature()
]); // set your payload, with more examples https://payment.tripay.co.id/developer
```

for get the payload u can use `getPayload()` method,

after set transaction u can sent the request and get data directly with the `getData () ` method or for more method u can seen in the [request method](#request-available) or can be see in examples

#### Get Open Detail Transaction

[](#get-open-detail-transaction)

To see further transaction data, you can see it in transaction details, for close transactions, see below where can i get uuid? please open the transaction menu then select open payment then there is a uuid code there

```
$uuidCode = 'your-uuid-code'; // fill by reference code

$detail = $transaction->getDetail($uuid); // return get detail your open transaction with your uuid code
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

### Get Daftar Pembayaran Transaction

[](#get-daftar-pembayaran-transaction)

To see a list of payments made in open transactions you can use this method you can get the uuid in your account.

```
$referenceCode = 'your-reference-code'; // fill by reference code

$detail = $transaction->getDetail($referenceCode); // return get detail your transaction with your reference code
```

the next method can be seen in the [request method](#request-available) or can be seen in examples

Callback
--------

[](#callback)

Callback is a method of sending transaction notifications from the TriPay server to the user's server. When the payment from the customer is completed, the TriPay system will provide a notification containing transaction data which can then be further managed by the user's system.

please define the method below before starting

```
$init = $main->initCallback(); // return callback
```

### Receive JSON

[](#receive-json)

to get the json that was sent by tripay you can use the method below

```
$init->get(); // get all callback
```

### Decode JSON

[](#decode-json)

rather than wasting time on json\_decode, this package provides that

```
$init->getJson(); // get json callback
```

### Get The Signature

[](#get-the-signature)

take signature from tripay using the method below

```
$init->signature(); // callback signature
```

### Callback Signature

[](#callback-signature)

tripay also sends a callback signature to validate customer data

```
$init->callbackSignature(); // callback signature
```

### Call Event

[](#call-event)

for re-validation, tripay sends an event in the form of `payment_status` this package also captures that

`php $init->callEvent(); // callback event, return `payment_status``

### Validate Signature

[](#validate-signature)

To shorten the code, we prepared signature validation as well.

```
$init->validateSignature(); // return `true` is valid signature, `false` invalid signature
```

### Validate Event

[](#validate-event)

To shorten the code too, we also set up validate events to go a step further

```
$init->validateEvent(); // return `true` is PAID, `false` meaning UNPAID,REFUND,etc OR call event undefined
```

Testing
-------

[](#testing)

This package is tested using PHPunit, but mostly direct testing

Contribute
----------

[](#contribute)

Project ini saya buat karena sebelumnya saya menggunakan tripay sebagai payment gateway, daripada kode saya nganggur jadi ada baiknya saya share. so, silahkan berkontribusi baik dari dokumentasi atau membenahi script dari package ini ;)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

1091d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rootwritter-tripay-payment-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/rootwritter-tripay-payment-gateway/health.svg)](https://phpackages.com/packages/rootwritter-tripay-payment-gateway)
```

###  Alternatives

[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[buckaroo/sdk

Buckaroo payment SDK

12189.1k8](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)

PHPackages © 2026

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