bnzo/laravel-fintecture

An opinionated Fintecture wrapper for Laravel apps.

Fund package maintenance!
bnzo

v0.1.9 2025-09-01 21:34 UTC

This package is auto-updated.

Last update: 2025-09-02 13:33:33 UTC


README

Laravel Telemaque

Laravel Fintecture

An opinionated Fintecture wrapper for Laravel apps.

Latest Version on Packagist GitHub Tests Action Status GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

⚠️ This package is under developement, do not use it in production. ⚠️

Installation

You can install the package via composer:

composer require bnzo/laravel-fintecture

You can publish the config file with:

php artisan vendor:publish --tag="laravel-fintecture-config"

This is the contents of the published config file:

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
];

Usage

Create a RequestToPay URL

This is a simple call using a basic PaymentRequestData object.
Please refer to the next section if you need more payment parameters such as currency, expiration time, and method ( link, sms, email ).

use Bnzo\Fintecture\Data\PaymentRequestData;
use Bnzo\Fintecture\Facades\Fintecture;

$paymentData = new PaymentData(
        new AttributesData(
            amount: '272.00',
            communication: 'test'
        ),
        new CustomerData(
            email: 'julien.lefebre@my-business-sarl.com',
            name: 'Julien Lefebvre'
        )
    );

$sessionData = Fintecture::generate(
    paymentData: $paymentData
);

$sessionData->sessionId; //d2e30e2c0b9e4ce5b26f59dc386b21b2
$sessionData->url; //https://fintecture.com/v2/85b0a547-5c18-4a16-b93b-2a4f5f03127d

Create a PaymentRequestData

Not all data fields are mandatory, please refer to each Data classes to see what you can use and what are default values.

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: 'julien.lefebre@my-business-sarl.com',
        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
    ),
);

Webhooks

Webhooks can be receive at this url /finctecure/webhook

  1. First, make sure to configure the webhook endpoint in your fintecture app:
Screenshot 2025-09-02 at 15 13 12
  1. Disable CSRF tokens for this route in you bootstrap app.php file:
//bootstrap/app.php
    ...
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->validateCsrfTokens(except: [
            '/fintecture/webhook',
        ]);
    })
    ...
  1. You can create a listener like so:
php artisan make:listener -e \\Bnzo\\Fintecture\\Events\\PayementCreated
// 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}";
    }
}

For now, you can create listeners for the following events, but more can be added in the route file web.php

PaymentCreated and PaymentUnsuccessful

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.