PHP code example of finopal / finopal-php-sdk

1. Go to this page and download the library: Download finopal/finopal-php-sdk 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/ */

    

finopal / finopal-php-sdk example snippets



use FinoPal\Sdk\FinoPal;
use FinoPal\Sdk\Options;

$options = new Options([
    'merchant_id' => 'fino-xxxx-xxxx-xxxx-xxxx',
    'sandbox' => false,
]);
$finopal = new FinoPal($options);
$paymentGateway = $finopal->paymentGateway();

use FinoPal\Sdk\Endpoint\PaymentGateway\RequestTypes\RequestRequest;

$request = new RequestRequest();
$request->amount = 10000;
$request->description = 'Payment for order 12345';
$request->callback_url = 'https://your-site.test/examples/verify.php';
$request->order_id = 'ORD-12345';
$request->mobile = '09120987654';
$request->email = '[email protected]';

$response = $paymentGateway->request($request);
header('Location: ' . $response->payment_url);

$paymentGateway->getRedirectUrl($response->authority);
bash
composer config repositories.finopal path ../finopal-php-sdk
composer