Download the PHP package rhaima/laravel-flouci without Composer
On this page you can find all versions of the php package rhaima/laravel-flouci. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-flouci
Laravel Flouci
Accept Flouci payments (Tunisia) in Laravel: create payments, verify them, handle the webhook with events, refund, and read the transaction history.
Requirements
- PHP 8.2+
- Laravel 12 or 13
Installation
The service provider and the Flouci facade are auto-discovered.
Configuration
Get your keys from the Flouci dashboard (every developer account has a TEST APP for the sandbox), then set:
Optionally publish the config file:
| Option | Env | Default | Description |
|---|---|---|---|
base_url |
FLOUCI_BASE_URL |
https://developers.flouci.com/api |
API base URL |
public_key |
FLOUCI_PUBLIC_KEY |
Public key | |
private_key |
FLOUCI_PRIVATE_KEY |
Private key | |
success_link |
FLOUCI_SUCCESS_LINK |
Default redirect after a successful payment | |
fail_link |
FLOUCI_FAIL_LINK |
Default redirect after a failed payment | |
webhook |
FLOUCI_WEBHOOK_URL |
Default webhook sent with each payment |
|
card_payment |
FLOUCI_CARD_PAYMENT |
true |
Default accept_card (Flouci's own default is false) |
image_url |
FLOUCI_IMAGE_URL |
Default image shown on the payment page | |
session_timeout |
FLOUCI_SESSION_TIMEOUT |
Flouci: 1200 | Payment session duration in seconds (session_timeout_secs) |
merchant_id |
FLOUCI_MERCHANT_ID |
Default merchant_id for transactionHistory() |
|
timeout |
FLOUCI_TIMEOUT |
15 |
HTTP timeout in seconds |
Usage
Create a payment
Any Flouci field can be passed per call and overrides the config defaults
(success_link, fail_link, webhook, accept_card, image_url, session_timeout_secs).
Verify a payment
Flouci appends payment_id to your success and fail links. Always verify it server-side:
PaymentStatus cases: Success, Pending, Expired, Failure, PreauthSuccess, SystemFailure.
isFinal() returns false for Pending and PreauthSuccess.
Webhook
Register the route (CSRF protection is removed automatically, so routes/web.php works):
Flouci calls it with GET ?payment_id=...&success=True|False and does not sign the request. The package
only trusts the payment_id, reads the real status from verifyPayment(), then dispatches an event:
| Flouci status | Event |
|---|---|
SUCCESS |
Flouci\Laravel\Events\PaymentSucceeded |
FAILURE, SYSTEM_FAILURE |
Flouci\Laravel\Events\PaymentFailed |
EXPIRED |
Flouci\Laravel\Events\PaymentExpired |
PENDING, PREAUTH_SUCCESS |
none |
Each event exposes paymentId, status (PaymentStatus), verification (raw response), trackingId() and
amount(). To handle every case in one listener, type-hint the FlouciPaymentEvent interface.
Good to know:
- Flouci retries the webhook until it gets a 2xx response. A replayed webhook dispatches its event only once (24h cache key): use a shared cache store (Redis, database) in production and keep an idempotency check on your order.
- If the Flouci API is unreachable during verification, the route answers 5xx so Flouci retries.
- Without a
payment_id, the route answers422.
Refund
Only completed, not yet refunded payments can be refunded. A refused refund always throws a
FlouciException, even when Flouci answers HTTP 200 with "status": "error".
Transaction history
Parameters are sent as-is to GET /api/developers/history
(docs). merchant_id is required: pass it in the
query or set FLOUCI_MERCHANT_ID.
Errors
Every failure (HTTP error, timeout, unreadable response) throws a FlouciException:
Testing your app
Fake the Flouci API with Laravel's HTTP client:
Test cards for the Flouci sandbox are listed in the Flouci docs.
AI agents
The package ships a Laravel Boost guideline and a flouci-payments skill, so
coding agents (Claude Code, Cursor, Codex...) learn how to integrate Flouci correctly. Run
php artisan boost:install (or boost:update --discover if Boost is already installed) after requiring the
package.
Contributing
To try the package against the real Flouci sandbox:
Open <APP_URL>/flouci/sandbox and pay with a test card. Webhook calls and dispatched events are logged to
vendor/orchestra/testbench-core/laravel/storage/logs/laravel.log.
Security
See SECURITY.md.
License
MIT. See LICENSE.
All versions of laravel-flouci with dependencies
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0