PHP code example of bnzo / laravel-fintecture
1. Go to this page and download the library: Download bnzo/laravel-fintecture 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/ */
bnzo / laravel-fintecture example snippets
return [
'app_id' => env('FINTECTURE_APP_ID'),
'app_secret' => env('FINTECTURE_APP_SECRET'),
'base_url' => env('FINTECTURE_BASE_URL'),
'environement' => env('FINTECTURE_ENVIRONMENT', 'sandbox'), // sandbox or production
'private_key' => env('FINTECTURE_PRIVATE_KEY') // base64 encoded private key
];
use Bnzo\Fintecture\Data\PaymentRequestData;
use Bnzo\Fintecture\Facades\Fintecture;
$paymentData = new PaymentData(
new AttributesData(
amount: '272.00',
communication: 'test'
),
new CustomerData(
email: '[email protected] ',
name: 'Julien Lefebvre'
)
);
$sessionData = Fintecture::generate(
paymentData: $paymentData
);
$sessionData->sessionId; //d2e30e2c0b9e4ce5b26f59dc386b21b2
$sessionData->url; //https://fintecture.com/v2/85b0a547-5c18-4a16-b93b-2a4f5f03127d
use Bnzo\Fintecture\Data\PaymentData;
$paymentRequestData = new PaymentData(
new AttributesData(
amount: '272.00',
communication: 'Order #1',
currency: Currency::EUR, // default Currency::EUR
language: 'en' //default App::getLocale()
state: "1" //default null
),
new CustomerData(
email: '[email protected] ',
name: 'Julien Lefebvre',
address: new AddressData(
street: '1 rue de la paix',
zip: '75000',
city: 'Paris',
country: 'FR',
),
),
new SettingsData(
due_date: 86400, // default 84000
expiry: 86400, // default 84000
method: Method::Link // default Link
permanent: false, // default false
redirectUri: "https://myapp.test/finctecture/callback" //default null
scheduled_expiration_policy: ScheduledExpirationPolicy::Immediate, // default Immediate
),
);
//bootstrap/app.php
...
->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'/fintecture/webhook',
]);
})
...
// app/Listeners/ValidateBankTransfer.php
namespace App\Listeners;
use Bnzo\Fintecture\Events\PaymentCreated;
class ValidateBankTransfer
{
public function handle(PaymentCreated $event): void
{
return "payment created for session {$event->sessionId}";
}
}
bash
php artisan vendor:publish --tag="laravel-fintecture-config"