1. Go to this page and download the library: Download risekucom/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/ */
use Risekucom\LaravelTripay\Facades\Tripay;
// Get available payment channels
$channels = Tripay::getPaymentChannelList();
// Get all payment channels
$channels = Tripay::getPaymentChannelList();
// Get specific payment channel by code
$channel = Tripay::getPaymentChannelList('BRIVA');
// 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)
);
// 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');
// 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
]);
// 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);
}
}
$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';
});
}
{
"code": 400,
"success": false,
"message": "Payment channel not available or under maintenance"
}