Laravel wrapper for Tripay payment gateway.
You can install the package via composer:
composer require ibnuhalimm/laravel-tripay
Optionally, you can publish the config file of this package with this command:
php artisan vendor:publish --tag="laravel-tripay-config"
Put some environment variable to .env
file:
TRIPAY_MERCHANT_CODE=
TRIPAY_API_KEY=
TRIPAY_PRIVATE_KEY=
TRIPAY_PRODUCTION_MODE=
** Valid value for TRIPAY_PRODUCTION_MODE
is true
or false
You can directly use the Tripay
Facade (the alias or class itself):
use Ibnuhalimm\LaravelTripay\Facades\Tripay;
// Get all available payment channels
Tripay::paymentChannels();
// Or get single payment channels by specifying the code
Tripay::paymentChannels('BRIVA');
use Ibnuhalimm\LaravelTripay\Facades\Tripay;
$amount = 12000;
$paymentChannelCode = 'BRIVA';
Tripay::feeCalculator($amount, $paymentChannelCode);
use Ibnuhalimm\LaravelTripay\Facades\Tripay;
Tripay::transactions();
use Ibnuhalimm\LaravelTripay\Facades\Tripay;
$reference = 'DEV-T11958501451EJYV'; // Get from create transaction response / Transaction list
Tripay::transactionDetails($reference);
use Ibnuhalimm\LaravelTripay\Facades\Tripay;
// All required parameters
$params = [
'method' => 'MANDIRIVA',
'merchant_ref' => 'INV-123456',
'amount' => 25000,
'customer_name' => 'Your Customer Name',
'customer_email' => '[email protected]',
'customer_phone' => '081234567890',
'order_items' => [
[
'name' => 'Product Name 1',
'price' => 6000,
'quantity' => 2
],
[
'name' => 'Product Name 2',
'price' => 13000,
'quantity' => 1
]
]
];
// You can override the callback URL
// By adding the `callback_url` parameter
$params = [
...
'callback_url' => 'https://yourdomain.tld/callback',
...
];
// By default, expired time will be set for 24 hours
// You can change it by adding 'expired_time'
$params = [
...
'expired_time' => 1582855837 // Should be in integer value as unix format
...
];
// Add more info of ordered items
$params = [
...
'order_items' => [
[
'sku' => 'FB-01',
'name' => 'Product Name',
'price' => 20000,
'quantity' => 1,
'product_url' => 'https://yourstore.com/product/product-01',
'image_url' => 'https://yourstore.com/product/product-01.jpg',
],
[
'sku' => 'FB-07',
'name' => 'Product Name 2',
'price' => 5000,
'quantity' => 1,
'product_url' => 'https://yourstore.com/product/product-02',
'image_url' => 'https://yourstore.com/product/product-02.jpg',
]
],
...
];
Tripay::createTransaction($params);
use Ibnuhalimm\LaravelTripay\Facades\Tripay;
// Override the default config
Tripay::setConfig([
'merchant_code' => 'NEW-CODE',
'api_key' => 'ANOTHER-API-KEY',
...
])->paymentChannels();
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.