PHPackages                             gonon/laravel-tripay - 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. gonon/laravel-tripay

ActiveLibrary[Payment Processing](/categories/payments)

gonon/laravel-tripay
====================

Laravel integration for the Gonon Tripay SDK

1.0.0(1mo ago)00MITPHPPHP ^8.2CI passing

Since Jul 9Pushed 1mo agoCompare

[ Source](https://github.com/GononLabs/laravel-tripay)[ Packagist](https://packagist.org/packages/gonon/laravel-tripay)[ Docs](https://github.com/GononLabs/laravel-tripay)[ RSS](/packages/gonon-laravel-tripay/feed)WikiDiscussions main Synced 1w ago

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

[![Build Status](https://github.com/GononLabs/laravel-tripay/actions/workflows/ci.yml/badge.svg)](https://github.com/GononLabs/laravel-tripay/actions)[![Coverage Status](https://camo.githubusercontent.com/606106afa33522781bd230a24e310770b37eeb2ad79a256a5b9c5fa561b5b481/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f476f6e6f6e4c6162732f6c61726176656c2d7472697061792f62616467652e737667)](https://coveralls.io/github/GononLabs/laravel-tripay)[![PHP Version](https://camo.githubusercontent.com/6112e2e3c4e1ed2bd46118df11e072ab4694498246b546a993c32eb354f1cc5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f676f6e6f6e2f6c61726176656c2d7472697061792e737667)](https://packagist.org/packages/gonon/laravel-tripay)[![Latest Version](https://camo.githubusercontent.com/4a3ab215401db20313920ebee9a8c12efdfcfd22c3d626989a961c29e9de8f91/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f6e6f6e2f6c61726176656c2d7472697061792e737667)](https://packagist.org/packages/gonon/laravel-tripay)

Laravel Tripay
==============

[](#laravel-tripay)

An elegant, idiomatic Laravel integration for the official Gonon Tripay PHP SDK.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11+
- gonon/tripay ^1.0

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

[](#installation)

```
composer require gonon/laravel-tripay
```

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

[](#configuration)

First, publish the configuration file to your application:

```
php artisan vendor:publish --tag="tripay-config"
```

or

```
php artisan vendor:publish --provider="Gonon\Tripay\Laravel\TripayServiceProvider"
```

This will create a `config/tripay.php` file in your application where you can customize the default settings.

Next, set up your `.env` with the credentials from your Tripay Merchant Dashboard:

```
TRIPAY_API_KEY=your_api_key
TRIPAY_PRIVATE_KEY=your_private_key
TRIPAY_MERCHANT_CODE=your_merchant_code
TRIPAY_PRODUCTION=false # Set to true for production
```

Usage (Facade)
--------------

[](#usage-facade)

The package provides an expressive `Tripay` facade that hooks directly into the underlying SDK. It handles all authentication, configuration, and signature generation behind the scenes seamlessly.

First, ensure you import the facade and necessary DTOs at the top of your classes:

```
use Gonon\Tripay\Laravel\Facades\Tripay;
use Gonon\Tripay\DTO\CreateTransactionRequest;
```

### 1. Fetching Payment Channels

[](#1-fetching-payment-channels)

Retrieve a list of available payment channels you can offer to your customers:

```
// Get all available payment channels
$channels = Tripay::paymentChannels()->list();

foreach ($channels as $channel) {
    echo $channel->code; // e.g., 'BRIVA', 'OVO'
    echo $channel->name;
    echo $channel->isActive ? 'Active' : 'Inactive';
}
```

### 2. Creating a Transaction (Closed Payment)

[](#2-creating-a-transaction-closed-payment)

Create a transaction and automatically generate a checkout URL for the customer. The SDK will automatically generate the HMAC signature using your private key.

```
$payload = new CreateTransactionRequest(
    method: 'BRIVA',
    merchantRef: 'INV-12345',
    amount: 150000,
    customerName: 'John Doe',
    customerEmail: 'john.doe@example.com',
    customerPhone: '08123456789',
    orderItems: [
        [
            'sku'      => 'PROD-01',
            'name'     => 'Premium Package',
            'price'    => 150000,
            'quantity' => 1,
        ]
    ],
    returnUrl: route('payment.return')
);

try {
    $transaction = Tripay::transactions()->create($payload);

    // Redirect customer to the Tripay checkout page
    return redirect($transaction->checkoutUrl);

} catch (\Gonon\Tripay\Exceptions\TransactionException $e) {
    return back()->withError($e->getMessage());
}
```

### 3. Fetching Transaction Details

[](#3-fetching-transaction-details)

Retrieve the real-time status and details of a transaction using your merchant reference.

```
$transaction = Tripay::transactions()->detail('INV-12345');

echo $transaction->status; // 'PAID', 'UNPAID', 'EXPIRED', 'FAILED'
echo $transaction->amount;
echo $transaction->checkoutUrl;
```

### 4. Fee Calculator

[](#4-fee-calculator)

Calculate the total fees for a specific payment channel before creating a transaction.

```
use Gonon\Tripay\DTO\FeeCalculationRequest;

$fees = Tripay::calculator()->calculate(
    new FeeCalculationRequest(amount: 150000, code: 'BRIVA')
);

echo $fees->totalFee;
echo $fees->feeMerchant;
echo $fees->feeCustomer;
```

### 5. Webhook Signature Verification

[](#5-webhook-signature-verification)

When Tripay sends a webhook notification to your application, you must verify the signature to ensure the payload is authentic.

```
use Illuminate\Http\Request;

public function handleWebhook(Request $request)
{
    $signature = $request->header('X-Callback-Signature');
    $payload = $request->getContent();

    // The webhook handler automatically uses your configured private key
    $isValid = Tripay::webhook()->verifySignature($signature, $payload);

    if (! $isValid) {
        abort(403, 'Invalid signature');
    }

    $event = json_decode($payload);

    if ($event->status === 'PAID') {
        // Update order status in your database
    }

    return response()->json(['success' => true]);
}
```

Advanced: Dependency Injection &amp; Container
----------------------------------------------

[](#advanced-dependency-injection--container)

If you prefer passing the client via Dependency Injection instead of using the static Facade, the `TripayClient` is automatically bound to the Service Container as a singleton.

```
use Gonon\Tripay\Client\TripayClient;

class CheckoutController
{
    public function __construct(
        private readonly TripayClient $tripay
    ) {}

    public function process()
    {
        $channels = $this->tripay->paymentChannels()->all();
    }
}
```

You can also resolve the client manually using the `app()` helper anywhere in your application:

```
$tripay = app(\Gonon\Tripay\Client\TripayClient::class);
// or via the bound alias
$tripay = app('tripay');
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

47d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravellaravel-packagepayment-gatewaypayment-processorphptripaylaravelsdkpaymentgatewaytripay

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gonon-laravel-tripay/health.svg)

```
[![Health](https://phpackages.com/badges/gonon-laravel-tripay/health.svg)](https://phpackages.com/packages/gonon-laravel-tripay)
```

###  Alternatives

[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4952.7k](/packages/sebdesign-laravel-viva-payments)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

3827.1k](/packages/linkxtr-laravel-qrcode)

PHPackages © 2026

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