PHPackages                             yallapaysudan/laravel-yallapaysudan - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. yallapaysudan/laravel-yallapaysudan

ActiveLibrary

yallapaysudan/laravel-yallapaysudan
===================================

Laravel package for YallaPaySudan payment gateway

50PHP

Since Mar 27Pushed 1mo agoCompare

[ Source](https://github.com/amolood/yallapaysudan-laravel)[ Packagist](https://packagist.org/packages/yallapaysudan/laravel-yallapaysudan)[ RSS](/packages/yallapaysudan-laravel-yallapaysudan/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

YallaPaySudan Laravel Package
=============================

[](#yallapaysudan-laravel-package)

Laravel package for integrating with the [YallaPaySudan](https://yallapaysudan.com) payment gateway.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

Installation
------------

[](#installation)

```
composer require yallapaysudan/laravel-yallapaysudan
```

Publish the config file:

```
php artisan vendor:publish --tag=yallapaysudan-config
```

Configuration
-------------

[](#configuration)

Add the following to your `.env` file:

```
YALLAPAY_AUTHORIZATION_TOKEN=your-authorization-token
YALLAPAY_SECRET_KEY=your-secret-key

# Optional — fallback redirect URLs (can also be set per-transaction)
YALLAPAY_REDIRECT_SUCCESS=https://yoursite.com/payment/success
YALLAPAY_REDIRECT_FAILED=https://yoursite.com/payment/failed

# Optional
YALLAPAY_COMMISSION_BY_CUSTOMER=false
YALLAPAY_WEBHOOK_PATH=yallapay/webhook
YALLAPAY_WEBHOOK_TOLERANCE=5
```

Both the Authorization Token and Secret Key are found in the **Developers** section of your YallaPaySudan merchant dashboard.

---

Usage
-----

[](#usage)

### One-Time Payment

[](#one-time-payment)

```
use YallaPaySudan\Facades\YallaPaySudan;
use YallaPaySudan\Exceptions\PaymentException;

try {
    $response = YallaPaySudan::createPayment(
        amount: 500,
        clientReferenceId: 'order_' . $order->id,
        options: [
            'description'                  => 'Order #' . $order->id,
            'paymentSuccessfulRedirectUrl' => route('payment.success'),
            'paymentFailedRedirectUrl'     => route('payment.failed'),
            'commissionPaidByCustomer'     => false,
        ]
    );

    return redirect($response->paymentUrl);

} catch (PaymentException $e) {
    // API returned a non-success response code
    logger()->error('YallaPaySudan error', ['message' => $e->getMessage(), 'code' => $e->getResponseCode()]);
    abort(500, 'Payment initiation failed.');
}
```

### Subscription Payment

[](#subscription-payment)

```
use YallaPaySudan\Facades\YallaPaySudan;

$response = YallaPaySudan::createSubscription(
    amount: 100,
    clientReferenceId: 'sub_' . $subscription->id,
    interval: 'MONTH',      // DAY | MONTH | YEAR
    intervalCycle: 1,        // every 1 month
    options: [
        'totalCycles'  => 12, // 12 months; omit for indefinite
        'description'  => 'Monthly plan',
    ]
);

return redirect($response->paymentUrl);
```

### PaymentResponse Object

[](#paymentresponse-object)

```
$response->isSuccessful();     // bool
$response->paymentUrl;         // string — redirect the user here
$response->responseCode;       // "0" on success
$response->responseMessage;    // "Success"
$response->currentDate;        // "2025-06-22"
$response->currentTime;        // "13:25:20"
$response->raw;                // full raw array from the API
```

---

Webhooks
--------

[](#webhooks)

The package automatically registers a webhook endpoint at `POST /yallapay/webhook` (configurable via `YALLAPAY_WEBHOOK_PATH`).

### Listening to Webhook Events

[](#listening-to-webhook-events)

Register a listener for `WebhookReceived` in your `EventServiceProvider` (or using `#[AsEventListener]`):

```
use YallaPaySudan\Events\WebhookReceived;

class HandleYallaPayWebhook
{
    public function handle(WebhookReceived $event): void
    {
        if ($event->isSuccessful()) {
            // Mark order as paid
            Order::where('reference', $event->clientReferenceId)
                ->update(['status' => 'paid', 'payment_reference' => $event->paymentReferenceId]);
        }

        if ($event->isFailed() || $event->isCancelled()) {
            // Handle failure
        }
    }
}
```

```
// EventServiceProvider
protected $listen = [
    \YallaPaySudan\Events\WebhookReceived::class => [
        \App\Listeners\HandleYallaPayWebhook::class,
    ],
];
```

### Webhook Payload

[](#webhook-payload)

FieldTypeDescription`clientReferenceId`stringYour order/transaction ID`paymentReferenceId`stringYallaPaySudan's internal reference`status`string`SUCCESSFUL`, `FAILED`, or `CANCELLED``timestamp`intUnix timestamp in milliseconds### Security

[](#security)

Every incoming webhook is automatically verified:

- **HMAC-SHA-256 signature** checked against your secret key using the raw JSON body bytes.
- **Timestamp tolerance** (default: 5 minutes) to prevent replay attacks.

Requests failing either check receive a `401` response.

> **Important:** Ensure your webhook endpoint is excluded from Laravel's CSRF middleware. If using `routes/web.php`, add the path to `$except` in `VerifyCsrfToken`. The package registers its route with the `api` middleware group by default, so CSRF is not applied.

### Idempotency

[](#idempotency)

YallaPaySudan may deliver the same webhook more than once. Use `clientReferenceId` and `paymentReferenceId` together to deduplicate.

---

Testing
-------

[](#testing)

```
composer test
```

---

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance60

Regular maintenance activity

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8304924?v=4)[ABDALRAHMAN MOLOOD](/maintainers/amolood)[@amolood](https://github.com/amolood)

### Embed Badge

![Health badge](/badges/yallapaysudan-laravel-yallapaysudan/health.svg)

```
[![Health](https://phpackages.com/badges/yallapaysudan-laravel-yallapaysudan/health.svg)](https://phpackages.com/packages/yallapaysudan-laravel-yallapaysudan)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
