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

ActiveLibrary[API Development](/categories/api)

gonon/tripay
============

Tripay SDK for the Gonon ecosystem

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

Since Jul 9Pushed 1mo agoCompare

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

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

Gonon Tripay SDK
================

[](#gonon-tripay-sdk)

[![Build Status](https://github.com/GononLabs/tripay/actions/workflows/ci.yml/badge.svg)](https://github.com/GononLabs/tripay/actions)[![Coverage Status](https://camo.githubusercontent.com/2058ff4c5d9e83e4e89e205effa73b5b70ae054953b7ac45cd99597622784bea/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f476f6e6f6e4c6162732f7472697061792f62616467652e737667)](https://coveralls.io/github/GononLabs/tripay)[![PHP Version](https://camo.githubusercontent.com/f89e4b5a97cbe4b885ad111ee1e1f95d9f3a9588abf4380a1759a49e8bb75cab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f676f6e6f6e2f7472697061792e737667)](https://packagist.org/packages/gonon/tripay)[![Latest Version](https://camo.githubusercontent.com/b579c8e2cfe72bae12e93baf8d50ffdbb07d9a1319c8b20535220848abcfd57f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f6e6f6e2f7472697061792e737667)](https://packagist.org/packages/gonon/tripay)

A modern, fully-typed **Tripay Payment Gateway SDK** for the Gonon ecosystem. It provides an object-oriented PHP API for interacting with Tripay's Closed and Open Payment APIs seamlessly.

- [Installation](#installation)
- [Usage / Initialization](#usage)
- [Methods' Signature and Examples](#methods-signature-and-examples)
    - [Payment Channels](#payment-channels)
        - [Get Payment Channels](#get-payment-channels)
    - [Fee Calculator](#fee-calculator)
        - [Calculate Fees](#calculate-fees)
    - [Instructions](#instructions)
        - [Get Payment Instructions](#get-payment-instructions)
    - [Closed Transaction](#closed-transaction)
        - [Create Transaction](#create-transaction)
        - [Get Transaction Detail](#get-transaction-detail)
    - [Open Payment](#open-payment)
        - [Create Open Payment](#create-open-payment)
        - [Get Open Payment Detail](#get-open-payment-detail)
    - [Webhook / Callback](#webhook--callback)
        - [Process Callback](#process-callback)
- [Exceptions](#exceptions)
- [Contributing](#contributing)

---

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

[](#installation)

```
composer require gonon/tripay
```

**Requirements:**

- PHP 8.2 or higher
- `gonon/core` ^1.0
- `gonon/http-symfony` ^1.0

Usage
-----

[](#usage)

Configure the SDK using the `TripayConfig` class and initialize `TripayClient`. By default, the SDK automatically wires up a robust HTTP pipeline with retry strategies and logging.

```
use Gonon\Tripay\Config\TripayConfig;
use Gonon\Core\Configuration\Environment;
use Gonon\Tripay\Client\TripayClient;

$config = new TripayConfig(
    apiKey: 'your-api-key',
    privateKey: 'your-private-key',
    merchantCode: 'T1234',
    environment: Environment::Sandbox // Use Environment::Production for live
);

$tripay = new TripayClient($config);
```

---

Methods' Signature and Examples
-------------------------------

[](#methods-signature-and-examples)

### Payment Channels

[](#payment-channels)

#### Get Payment Channels

[](#get-payment-channels)

Retrieve a list of all active payment channels available for your merchant account.

```
/**
 * @return \Gonon\Tripay\DTO\PaymentChannelData[]
 */
$channels = $tripay->paymentChannels()->list();

foreach ($channels as $channel) {
    echo "- {$channel->name} ({$channel->code})\n";
}
```

### Fee Calculator

[](#fee-calculator)

#### Calculate Fees

[](#calculate-fees)

Calculate the estimated merchant and customer fee for a specific channel and amount.

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

$request = new FeeCalculationRequest(
    amount: 150000,
    code: 'OVO'
);

/**
 * @return \Gonon\Tripay\DTO\FeeCalculationData
 */
$fee = $tripay->calculator()->calculate($request);
echo "Total Fee: {$fee->totalFee}";
```

### Instructions

[](#instructions)

#### Get Payment Instructions

[](#get-payment-instructions)

Retrieve step-by-step payment instructions (ATM, Mobile Banking, Internet Banking) for a specific payment channel.

```
/**
 * @return \Gonon\Tripay\DTO\InstructionData[]
 */
$instructions = $tripay->instructions()->list(
    code: 'BRIVA',
    payCode: '1234567890',
    amount: 150000,
    allowHtml: 0
);

foreach ($instructions as $instruction) {
    echo $instruction->title . "\n";
    foreach ($instruction->steps as $step) {
        echo "- {$step}\n";
    }
}
```

### Closed Transaction

[](#closed-transaction)

#### Create Transaction

[](#create-transaction)

Create a standard, one-time payment transaction.

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

$request = new CreateTransactionRequest(
    method: 'BRIVA',
    merchantRef: 'INV-' . time(),
    amount: 150000,
    customerName: 'Budi Santoso',
    customerEmail: 'budi@example.com',
    customerPhone: '081234567890',
    orderItems: [
        [
            'sku' => 'PROD-01',
            'name' => 'Mechanical Keyboard',
            'price' => 150000,
            'quantity' => 1
        ]
    ],
    returnUrl: 'https://your-website.com/success',
    expiredTime: time() + 86400 // 24 hours
);

/**
 * @return \Gonon\Tripay\DTO\TransactionData
 */
$transaction = $tripay->transactions()->create($request);
echo "Checkout URL: " . $transaction->checkoutUrl;
```

#### Get Transaction Detail

[](#get-transaction-detail)

Retrieve the current status of an existing closed transaction.

```
/**
 * @return \Gonon\Tripay\DTO\TransactionData
 */
$detail = $tripay->transactions()->detail('DEV-T1234567890');
echo "Status: " . $detail->status; // e.g. PAID, UNPAID, EXPIRED
```

### Open Payment

[](#open-payment)

*(Note: The Open Payment API is only available in the Production environment)*

#### Create Open Payment

[](#create-open-payment)

Create a dynamic QRIS/Virtual Account that can accept arbitrary amounts multiple times.

```
use Gonon\Tripay\DTO\CreateOpenPaymentRequest;

$request = new CreateOpenPaymentRequest(
    method: 'QRIS2',
    merchantRef: 'DONATION-001',
    customerName: 'Anonymous Donor'
);

/**
 * @return \Gonon\Tripay\DTO\OpenPaymentData
 */
$openPayment = $tripay->openPayments()->create($request);
echo "QR URL: " . $openPayment->qrUrl;
```

#### Get Open Payment Detail

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

Retrieve the current status and historical payments for an open payment.

```
/**
 * @return \Gonon\Tripay\DTO\OpenPaymentData
 */
$detail = $tripay->openPayments()->detail('uuid-string-here');
echo "Status: " . $detail->status;
```

### Webhook / Callback

[](#webhook--callback)

#### Process Callback

[](#process-callback)

Securely parse and verify the HMAC signature of incoming webhooks from Tripay.

```
// 1. Get raw input and header
$rawPayload = file_get_contents('php://input');
$signatureHeader = $_SERVER['HTTP_X_CALLBACK_SIGNATURE'] ?? '';

try {
    // 2. Pass to the SDK processor
    /**
     * @return \Gonon\Tripay\DTO\CallbackData
     */
    $callback = $tripay->webhook()->process($rawPayload, $signatureHeader);

    // 3. Handle the event
    if ($callback->event === 'payment_status' && $callback->status === 'PAID') {
        echo "Invoice {$callback->merchantRef} is Paid!";
    }

    echo json_encode(['success' => true]);
} catch (\Gonon\Tripay\Exceptions\WebhookSignatureException $e) {
    http_response_code(403);
    echo json_encode(['success' => false, 'error' => 'Invalid signature']);
}
```

---

Exceptions
----------

[](#exceptions)

The SDK throws specific exceptions depending on the failure type, making it easy to catch and handle errors.

- **`Gonon\Tripay\Exceptions\TripayException`**
    The base interface implemented by all exceptions in the SDK.
- **`Gonon\Tripay\Exceptions\TransactionException`**
    Thrown when a transaction-related API call fails (e.g. invalid amount, validation errors from Tripay).
- **`Gonon\Tripay\Exceptions\WebhookSignatureException`**
    Thrown when the `X-Callback-Signature` header does not match the computed HMAC SHA-256 payload, indicating a potentially forged request.
- **`Gonon\Tripay\Exceptions\WebhookPayloadException`**
    Thrown when the incoming JSON payload is malformed or missing required keys.

---

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

[](#contributing)

We welcome contributions to the Gonon Tripay SDK! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on our coding standards and how to submit pull requests.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community8

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

fintechgononpayment-gatewaypaymentsphpsdkapisdkpaymenttripaygonon

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.8M179](/packages/algolia-algoliasearch-client-php)[temporal/sdk

Temporal SDK

4163.2M27](/packages/temporal-sdk)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.5M254](/packages/api-platform-metadata)[comgate/sdk

Comgate PHP SDK

13388.6k](/packages/comgate-sdk)[webit/w-firma-api

wFirma.pl API

1922.6k](/packages/webit-w-firma-api)[bushlanov-dev/max-bot-api-client-php

Max Bot API Client library

488.7k](/packages/bushlanov-dev-max-bot-api-client-php)

PHPackages © 2026

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