nokimaro/liontech-php-sdk
Community-maintained PHP 8.3+ SDK for FusionPayments (formerly LionTech). Type-safe, domain-oriented API covering orders, payments, refunds, payouts, tokens, transfers, balances; PSR-18 compatible, supports token refresh, webhook verification, and RSA card encryption.
nokimaro/liontech-laravel, offering a facade, service provider, and config integration. This aligns perfectly with Laravel’s dependency injection and service container patterns.CreateOrderRequest, Money, Currency) reduce boilerplate and enforce data integrity, fitting Laravel’s Eloquent/value object paradigms.liontech()->orders()->create()), mirroring Laravel’s Eloquent query builder pattern.WebhookPayload::fromJson()) and typed event discrimination (WebhookEventType) simplify Laravel route/webhook controller implementation.refreshAndApply()) integrates cleanly with Laravel’s caching (e.g., Redis) and session management.baseUrl/secureUrl updates (e.g., LionTech → FusionPayments rebrand).config or vault (e.g., Hashicorp Vault) should store private keys.VerifyLionTechWebhook::handle()).HttpException) wrap SDK exceptions (e.g., ValidationException) for consistency?5522..., 4405...) sufficient for CI/CD, or need custom test data?RateLimitException) be logged/alerted (e.g., Laravel Horizon)?nokimaro/liontech-laravel provides:
liontech() facade).access_token, baseUrl, and webhook settings.LiontechRefundJob).composer require nokimaro/liontech-php-sdk nokimaro/liontech-laravel
php artisan vendor:publish --provider="Nokimaro\LionTech\Laravel\LiontechServiceProvider"
.env:
LIONTECH_ACCESS_TOKEN=your_token
LIONTECH_BASE_URL=https://api.fusionpayments.io
LIONTECH_WEBHOOK_SECRET=your_webhook_signing_key
use Nokimaro\LionTech\Facades\Liontech;
$order = Liontech::orders()->create($request);
Route::post('/liontech-webhook', [WebhookController::class, 'handle']);
orderId, paymentId, and txnId in Laravel models (e.g., Order::liontechOrderId).CreateOrderRequest/CreatePaymentRequest for checkout flows.LiontechRefundService).LiontechTokenRepository).log channel.nokimaro/liontech-php-sdk for updates (e.g., API endpoint changes).composer.json to avoid breaking changes..env or vault.config/liontech.php for environment-specific settings (e.g., sandbox vs. live).baseUrl domains).Problem or custom exceptions:
catch (ValidationException $e) {
throw new \Illuminate\Validation\ValidationException($e->getErrors());
}
App\Exceptions\Handler to format SDK errors for users.config/liontech.php:
'debug' => env('LIONTECH_DEBUG', false),
dd() or dump() for SDK responses.RateLimitException:
use Symfony\Component\HttpClient\RetryStrategy;
access_token across instances.php artisan queue:work).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Token expiration | Failed API calls | Auto-refresh via refreshAndApply(); retry with exponential backoff. |
| Webhook signature mismatch | Silent failures | Validate signatures in middleware; log/retry failed webhooks. |
| Payment gateway downtime | Checkout failures | Implement circuit breaker (e.g., Laravel\CircuitBreaker). |
| Invalid card data | ValidationException |
Return user-friendly errors (e.g., "Card declined"). |
| Rate limiting | Throttled requests | Queue delayed operations; monitor X-RateLimit-Remaining headers. |
| Database connection loss | Order/payment data mismatch | Use Laravel’s database transactions for critical operations. |
VerifyLiontechWebhook middleware).payUrl redirection and 3DS flows.CreateOrderRequest).How can I help you explore Laravel packages today?