nekoding/tripay

Tripay PHP Client for Laravel

v2.1.0 2024-07-31 15:16 UTC

This package is auto-updated.

Last update: 2024-10-31 00:28:34 UTC


README

Package ini digunakan untuk berinteraksi dengan API milik Tripay.

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require nekoding/tripay

Usage

use Nekoding\Tripay\Networks\HttpClient;
use Nekoding\Tripay\Tripay;
use Nekoding\Tripay\Signature;

$data = [
    'method'         => 'BRIVA',
    'merchant_ref'   => 'KODE INVOICE',
    'amount'         => 50000,
    'customer_name'  => 'Nama Pelanggan',
    'customer_email' => 'emailpelanggan@domain.com',
    'customer_phone' => '081234567890',
    'order_items'    => [
        [
            'sku'         => 'FB-06',
            'name'        => 'Nama Produk 1',
            'price'       => 50000,
            'quantity'    => 1,
            'product_url' => 'https://tokokamu.com/product/nama-produk-1',
            'image_url'   => 'https://tokokamu.com/product/nama-produk-1.jpg',
        ]
    ],
    'return_url'   => 'https://domainanda.com/redirect',
    'expired_time' => (time() + (24 * 60 * 60)), // 24 jam
    'signature'    => Signature::generate('KODE INVOICE' . 50000)
];

// dengan facade

$res = Tripay::createTransaction($data)
$res = Tripay::createTransaction($data, Tripay::CLOSE_TRANSACTION);

// tanpa facade

$tripay = new Tripay(new HttpClient('api_key_anda'));

$res = $tripay->createTransaction($data);
$res = $tripay->createTransaction($data, Tripay::CLOSE_TRANSACTION);

Method Available

Tripay

Signature

Cek pattern hash dari transaksi yang akan digunakan disini :
CLOSE TRANSACTION
OPEN TRANSACTION

Validasi Parameter

Package ini melakukan validasi data sebelum diteruskan ke API tripay untuk menghindari error pada parameter. berikut adalah list parameter yang perlu diperhatikan ketika membuat payload request.

Close Transaction Create

Referensi : Tripay doc

Close Transaction Detail

Referensi : Tripay doc

Open Transaction Create

Referensi : Tripay doc

Open Transaction Detail

Referensi : Tripay doc

Daftar Transaksi

Referensi : Tripay doc

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.