PHP code example of fadhila36 / sumopod-pay-laravel

1. Go to this page and download the library: Download fadhila36/sumopod-pay-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fadhila36 / sumopod-pay-laravel example snippets


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;

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
            // ...
        }
    }
}

use Fadhila36\SumoPodPay\Events\SumoPodWebhookReceived;
use App\Listeners\HandleSumoPodWebhook;

protected $listen = [
    SumoPodWebhookReceived::class => [
        HandleSumoPodWebhook::class,
    ],
];
bash
php artisan sumopod:install
bash
php artisan sumopod:status