achetibi/laravel-satim

Laravel package for integrating SATIM online payments.

v1.0.0 2025-06-28 00:26 UTC

This package is auto-updated.

Last update: 2025-06-28 00:45:19 UTC


README

Latest Version on Packagist Total Downloads Tests License

Laravel Satim is a clean, extensible Laravel package that provides seamless integration with the Satim online payment gateway.
It supports full transaction lifecycle handling: registration, confirmation, and refund, all wrapped in a service-oriented architecture.

🚀 Features

  • Simple configuration via .env
  • Clean service classes for payment flow:
    • Register
    • Confirm
    • Refund
  • Built-in error handling and response abstraction
  • Custom HTTP client wrapper using Laravel's Http facade
  • Laravel-native setup with service provider, config, and facade

📦 Installation

composer require achetibi/laravel-satim

⚙️ Configuration

Publish the config file:

php artisan vendor:publish --provider="LaravelSatim\SatimServiceProvider"

Add the following variables to your .env:

SATIM_USERNAME=your_username
SATIM_PASSWORD=your_password
SATIM_TERMINAL=your_terminal
SATIM_TIMEOUT=15
SATIM_LANGUAGE=fr
SATIM_CURRENCY=DZD
SATIM_API_URL=https://fake.satim.dz/payment/rest

🧠 Basic Usage

Register a transaction

use LaravelSatim\Contracts\SatimInterface;
use LaravelSatim\Http\Requests\SatimRegisterRequest;

$response = app(SatimInterface::class)->register(SatimRegisterRequest::make(
    orderNumber: 'ORD-123456',
    amount: 1500,
    returnUrl: route('payment.success'),
    udf1: 'ORD-123456'
));

Confirm a transaction

use LaravelSatim\Contracts\SatimInterface;
use LaravelSatim\Http\Requests\SatimConfirmRequest;

$response = app(SatimInterface::class)->confirm(SatimConfirmRequest::make(
    orderId: 'BnTjnFDzZSP97QXu8FXq'
));

Refund a transaction

use LaravelSatim\Contracts\SatimInterface;
use LaravelSatim\Http\Requests\SatimRefundRequest;

$response = app(SatimInterface::class)->refund(SatimRefundRequest::make(
    orderId: 'BnTjnFDzZSP97QXu8FXq',
    amount: 1500
));

All services return typed response or throw custom exceptions for errors.

Overriding language and currency (optional)

By default, the values for language and currency are loaded from your .env file.
If you need to override them on a per-request basis, you can call setLanguage() and setCurrency() on the service before executing the request:

use LaravelSatim\Contracts\SatimInterface;
use LaravelSatim\Enums\SatimLanguage;
use LaravelSatim\Enums\SatimCurrency;

$service = app(SatimInterface::class)
    ->setLanguage(SatimLanguage::AR)
    ->setCurrency(SatimCurrency::DZD);

$response = $service->register(SatimRegisterRequest::make(
    orderNumber: 'ORD-123456',
    amount: 1500,
    returnUrl: route('payment.success'),
    udf1: 'ORD-123456'
));

✅ Testing

Run the test suite:

composer test

📌 Roadmap

  • Register / Confirm / Refund operations
  • Request / Response validation layer
  • Exception mapping
  • End-to-end test suite with fake HTTP responses
  • Status operation
  • Webhook support

🔒 Security

If you discover any security-related issues, please email chetibi.abderrahim@gmail.com instead of using the issue tracker.

🙏 Credits

📄 License

The MIT License (MIT).
See LICENSE.md for full license text.