1. Go to this page and download the library: Download ibnuhalimm/laravel-tripay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ibnuhalimm / laravel-tripay example snippets
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 '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();