fadhila36 / sumopod-pay-laravel
Unofficial Laravel SDK for the SumoPod Payment Gateway — QRIS payments, webhook verification, and more.
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
- illuminate/contracts: ^11.0|^12.0
- illuminate/http: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
Unofficial Laravel SDK for the SumoPod Payment Gateway. This package provides a seamless integration with SumoPod, allowing you to create payments and handle secure webhooks directly within your Laravel application.
Warning
Disclaimer: This package is an unofficial SDK created by a third party. It is not affiliated with, maintained, authorized, endorsed, or sponsored by SumoPod. All trademarks, service marks, and trade names of SumoPod used herein are the property of SumoPod.
Features
- 🚀 Laravel Native — Uses Laravel's HTTP Client, Facades, and config system.
- 🔌 Easy Installation — Built-in Artisan command to publish config and update your
.env. - 🔒 Secure Webhooks — Out-of-the-box middleware for Svix-style HMAC signature & token verification.
- ♻️ Automatic Retry — Exponential backoff for network issues and 5xx errors.
- 🎯 Strongly Typed — Written with strict types, DTOs, and full static analysis (Larastan Level 6).
Installation
You can install the package via composer:
composer require fadhila36/sumopod-pay-laravel
After installing, run the interactive install command:
php artisan sumopod:install
This command will:
- Publish the
config/sumopod-pay.phpfile to your app. - Automatically append the required SumoPod variables to your
.envand.env.examplefiles if they don't exist yet.
(Note: We provide an .env.example inside this package if you prefer to see the variables manually, but the install command handles adding them to your project automatically!)
Environment Variables
Make sure to fill in your API key in your .env file:
SUMOPOD_API_KEY=your_api_key_here SUMOPOD_BASE_URL=https://api-pay-sandbox.sumopod.com/api/v1 SUMOPOD_WEBHOOK_SECRET=whsec_xxx SUMOPOD_WEBHOOK_TOKEN=whtok_xxx SUMOPOD_VERIFICATION_METHOD=signature # or 'token'
Usage
Creating a Payment
You can use the provided SumoPod Facade to interact with the API cleanly:
use Fadhila36\SumoPodPay\Facades\SumoPod; use Fadhila36\SumoPodPay\Data\CreatePaymentData; $paymentData = new CreatePaymentData( orderId: 'INV-2026-001', amount: 50000, currency: 'IDR', // default paymentMethodTypeCode: 'QRIS', successReturnUrl: 'https://yourapp.com/payment/success', cancelReturnUrl: 'https://yourapp.com/payment/cancel', ); $response = SumoPod::createPayment($paymentData); // The response is a strongly-typed PaymentResponse DTO echo $response->paymentLinkUrl; // https://pay.sumopod.com/link/... echo $response->paymentId; echo $response->netAmount;
Webhooks
This package automatically registers a highly secure webhook endpoint at /sumopod/webhook (you can change this path in the config file).
The endpoint uses a dedicated middleware (VerifyWebhookSignature) to ensure the request genuinely came from SumoPod by computing the Svix-style HMAC signature or checking the Static Token.
Listening to Webhook Events
When a valid webhook is received, the package dispatches a standard Laravel event: Fadhila36\SumoPodPay\Events\SumoPodWebhookReceived.
To handle webhooks, simply create a listener for this event in your Laravel app:
namespace App\Listeners; use Fadhila36\SumoPodPay\Events\SumoPodWebhookReceived; class HandleSumoPodWebhook { public function handle(SumoPodWebhookReceived $event): void { $payload = $event->payload; if ($payload->isType('payment.completed')) { $paymentId = $payload->data['payment_id']; $orderId = $payload->data['order_id']; // Mark order as paid in your database // ... } } }
Register your listener in your EventServiceProvider:
use Fadhila36\SumoPodPay\Events\SumoPodWebhookReceived; use App\Listeners\HandleSumoPodWebhook; protected $listen = [ SumoPodWebhookReceived::class => [ HandleSumoPodWebhook::class, ], ];
Checking API Connection
We provide a handy artisan command to verify your API key and connection to the SumoPod servers:
php artisan sumopod:status
Testing
# Run tests composer test # Run tests with coverage composer test-coverage # Run static analysis composer analyse # Format code composer format
Security
If you discover any security related issues, please email fadhila36@users.noreply.github.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.