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

ActiveLibrary

risekucom/laravel-tripay
========================

Unofficial Laravel package for Tripay Payment API.

v1.0.0(1y ago)111MITPHPPHP ^8.1

Since Feb 25Pushed 1y ago1 watchersCompare

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

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

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

[](#laravel-tripay)

A Laravel package for integrating with the Tripay Payment Gateway API. This package provides a simple and elegant way to interact with Tripay's payment services in your Laravel applications.

Features
--------

[](#features)

- Simple integration with Tripay payment gateway
- Support for closed and open payment transactions
- Payment channel management
- Transaction fee calculations
- Callback verification
- Laravel-friendly response handling

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher

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

[](#installation)

You can install the package via composer:

```
composer require risekucom/laravel-tripay
```

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

[](#configuration)

After installation, publish the configuration file:

```
php artisan vendor:publish --provider="Risekucom\LaravelTripay\TripayServiceProvider"
```

This will create a `config/tripay.php` file in your config directory. Edit this file with your Tripay API credentials:

```
// config/tripay.php
return [
    'tripay_api_production' => env('TRIPAY_API_PRODUCTION', false),
    'tripay_api_key' => env('TRIPAY_API_KEY'),
    'tripay_private_key' => env('TRIPAY_PRIVATE_KEY'),
    'tripay_merchant_code' => env('TRIPAY_MERCHANT_CODE'),
];
```

Then, add these variables to your `.env` file:

```
TRIPAY_API_PRODUCTION=false
TRIPAY_API_KEY=
TRIPAY_PRIVATE_KEY=
TRIPAY_MERCHANT_CODE=

```

Set `TRIPAY_API_PRODUCTION` to `true` when you're ready to process real payments.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Risekucom\LaravelTripay\Facades\Tripay;

// Get available payment channels
$channels = Tripay::getPaymentChannelList();
```

### Available Methods

[](#available-methods)

#### Get Payment Channel List

[](#get-payment-channel-list)

Retrieve available payment channels from Tripay:

```
// Get all payment channels
$channels = Tripay::getPaymentChannelList();

// Get specific payment channel by code
$channel = Tripay::getPaymentChannelList('BRIVA');
```

[Official Documentation: Payment Channel List](https://tripay.co.id/developer?tab=merchant-payment-channel)

#### Get Payment Instructions

[](#get-payment-instructions)

Retrieve payment instructions for a specific payment method:

```
// Get payment instructions for BRIVA
$instructions = Tripay::getPaymentInstructionList('BRIVA');

// Get payment instructions with additional parameters
$instructions = Tripay::getPaymentInstructionList(
    'BRIVA',
    'PAYMENT123',  // Optional payment code
    50000,         // Optional amount
    1              // Allow HTML in instructions (1 = yes, 0 = no)
);
```

[Official Documentation: Payment Instructions](https://tripay.co.id/developer?tab=payment-instruction)

#### Calculate Transaction Fee

[](#calculate-transaction-fee)

Get fee details for a specific payment method and amount:

```
// Calculate fee for a 100,000 IDR transaction using all payments
$feeDetails = Tripay::getTransactionFeeDetails(100000);

// Calculate fee for a 100,000 IDR transaction using BRIVA
$feeDetails = Tripay::getTransactionFeeDetails(100000, 'BRIVA');
```

[Official Documentation: Transaction Fee](https://tripay.co.id/developer?tab=merchant-fee-calculator)

#### Create Closed Transaction

[](#create-closed-transaction)

Create a new closed payment transaction:

```
$transactionData = [
    'method'         => 'BRIVA',
    'customer_name'  => 'Nama Pelanggan',
    'customer_email' => 'emailpelanggan@domain.com',
    'customer_phone' => '081234567890',
    'order_items'    => [
        [
            'sku'         => 'FB-06',
            'name'        => 'Nama Produk 1',
            'price'       => 500000,
            'quantity'    => 1,
            'product_url' => 'https://tokokamu.com/product/nama-produk-1',
            'image_url'   => 'https://tokokamu.com/product/nama-produk-1.jpg',
        ],
        [
            'sku'         => 'FB-07',
            'name'        => 'Nama Produk 2',
            'price'       => 500000,
            'quantity'    => 1,
            'product_url' => 'https://tokokamu.com/product/nama-produk-2',
            'image_url'   => 'https://tokokamu.com/product/nama-produk-2.jpg',
        ]
    ],
    'return_url'   => 'https://domainanda.com/redirect',
    'expired_time' => (time() + (24 * 60 * 60)), // 24 hours
];

$transaction = Tripay::createClosedTransaction($transactionData);
```

[Official Documentation: Create Closed Transaction](https://tripay.co.id/developer?tab==transaction-create)

#### Get Closed Transaction Details

[](#get-closed-transaction-details)

Retrieve details of a closed transaction:

```
$transaction = Tripay::getClosedTransactionDetail('T123456789');
```

[Official Documentation: Transaction Detail](https://tripay.co.id/developer?tab=transaction-detail)

#### Create Open Transaction

[](#create-open-transaction)

Create a new open payment transaction:

```
$transactionData = [
    'method' => 'QRIS',
    'merchant_ref' => 'INV-' . time(),
    'customer_name' => 'John Doe',
    'callback_url' => 'https://yourdomain.com/payment/callback',
];

$transaction = Tripay::createOpenTransaction($transactionData);
```

[Official Documentation: Create Open Transaction](https://tripay.co.id/developer?tab=open-payment-create)

#### Get Open Transaction Details

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

Retrieve details of an open transaction:

```
$transaction = Tripay::getOpenTransactionDetail('uuid-string-here');
```

[Official Documentation: Open Transaction Detail](https://tripay.co.id/developer?tab=open-payment-detail)

#### Get Open Transaction List

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

Retrieve a list of open transactions:

```
$transactions = Tripay::getOpenTransactionList('uuid-string-here');
```

[Official Documentation: Open Transaction List](https://tripay.co.id/developer?tab=open-payment-transactions)

#### Get Merchant Transaction List

[](#get-merchant-transaction-list)

Get a list of merchant transactions:

```
// Get all transactions
$transactions = Tripay::getMerchantTransactionList();

// Get transactions with filters
$transactions = Tripay::getMerchantTransactionList([
    'page' => 1,
    'per_page' => 25,
    'sort' => 'desc',
    'reference' => 'T123456789',  // Optional specific transaction
    'merchant_ref' => 'INV123',   // Optional merchant reference
    'status' => 'PAID',           // Optional status filter
]);
```

[Official Documentation: Merchant Transaction List](https://tripay.co.id/developer?tab=merchant-transactions)

#### Verify Callback Data

[](#verify-callback-data)

Verify the authenticity of callback data from Tripay:

```
// In your callback controller
public function handleCallback(Request $request)
{
    $callbackData = $request->getContent();
    $callbackSignature = $request->server('HTTP_X_CALLBACK_SIGNATURE');
    $callbackEvent = $request->server('HTTP_X_CALLBACK_EVENT');

    try {
        $result = Tripay::verifyCallbackData(
            $callbackData,
            $callbackSignature,
            $callbackEvent
        );

        if (!$result->get('success')) {
            throw new \Exception($result->get('message'), $result->get('code'));
        }

        // Process the payment based on the callback data
        // $result contains the verified data
        $data = $result->get('data');

        return response()->json(['success' => true]);
    } catch (\Exception $e) {
        return response()->json(['error' => $e->getMessage()], 400);
    }
}
```

[Official Documentation: Callback](https://tripay.co.id/developer?tab=callback)

Response Handling
-----------------

[](#response-handling)

All methods return a Laravel `Collection` instance, which provides a fluent interface for working with the response data:

```
$channels = Tripay::getPaymentChannelList();

// Check if request was successful
if ($channels->get('success')) {
    // Access the data
    $paymentMethods = $channels->get('data');

    // Filter payment methods
    $bankTransfers = collect($paymentMethods)->filter(function ($method) {
        return $method['group'] === 'Virtual Account';
    });
}
```

Error Handling
--------------

[](#error-handling)

The package returns error responses in this format:

```
{
    "code": 400,
    "success": false,
    "message": "Payment channel not available or under maintenance"
}
```

You can handle these errors in your application:

```
$transaction = Tripay::getClosedTransactionDetail('INVALID-REF');

if (!$transaction->get('success')) {
    // Handle the error
    $errorCode = $transaction->get('code');
    $errorMessage = $transaction->get('message');

    return response()->json([
        'success' => false,
        'message' => $errorMessage
    ], $errorCode);
}

// Continue processing successful response
```

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Shofi Setiawan](https://github.com/shofistwn)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Acknowledgments
---------------

[](#acknowledgments)

This is an unofficial package and is not affiliated with Tripay. Always refer to the [official Tripay documentation](https://tripay.co.id/developer) for the latest API details.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance44

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

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

442d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b8970798d868790e3156565613ab5c31464de9907cb19e0cc370b533972bf6a?d=identicon)[shofistwn](/maintainers/shofistwn)

---

Top Contributors

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

---

Tags

laravelpayment gatewaytripay

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[luigel/laravel-paymongo

A laravel wrapper for Paymongo API

7956.2k1](/packages/luigel-laravel-paymongo)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[victorybiz/laravel-crypto-payment-gateway

GoUrl.io Crypto Payment Gateway for Laravel

642.5k](/packages/victorybiz-laravel-crypto-payment-gateway)

PHPackages © 2026

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