PHP code example of rublex / laravel-finpay-gateway
1. Go to this page and download the library: Download rublex/laravel-finpay-gateway 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/ */
rublex / laravel-finpay-gateway example snippets
use Finpay\Data\CustomerData;
use Finpay\Data\OrderData;
use Finpay\Facades\Finpay;
$response = Finpay::initiatePayment(
new CustomerData(
email: '[email protected] ',
firstName: 'Hajar',
lastName: 'Ismail',
mobilePhone: '+6281286288844'
),
new OrderData(
id: 'INV-1774369486',
amount: '10',
currency: 'EUR',
description: 'Testing'
),
userCallbackUrl: 'https://example.com/payment/final-callback'
);
// Unified wrapper response shape:
// [
// 'status' => 'pending',
// 'responseCode' => '2000000',
// 'responseMessage' => 'Initiated',
// 'orderId' => 'INV-1774369486',
// 'transactionId' => 'TRX-123',
// 'redirect_url' => 'https://pay.example/redirect/...',
// 'gatewayReference' => 'REF-123',
// 'raw' => [/* full provider payload */],
// ]
use Finpay\Services\FinpayGatewayService;
use Rublex\CoreGateway\Data\DynamicDataBag;
use Rublex\CoreGateway\Data\PaymentRequestData;
$gateway = app(FinpayGatewayService::class);
$result = $gateway->initiate(new PaymentRequestData(
gatewayCode: $gateway->code(),
orderId: 'INV-1774369486',
amount: '10',
currency: 'EUR',
callbackUrl: 'https://example.com/payment/final-callback',
meta: new DynamicDataBag([
'customer' => [
'email' => '[email protected] ',
'firstName' => 'Hajar',
'lastName' => 'Ismail',
'mobilePhone' => '+6281286288844',
],
'order' => [
'description' => 'Testing',
],
])
));
bash
php artisan vendor:publish --provider="Finpay\FinpayServiceProvider" --tag="finpay-config"