PHPackages                             rstacode/wayl - 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. [Payment Processing](/categories/payments)
4. /
5. rstacode/wayl

ActiveLibrary[Payment Processing](/categories/payments)

rstacode/wayl
=============

Laravel SDK for Wayl.io - E-commerce payment platform for Iraq and Middle East

1.0.2(3mo ago)5134↓40%MITPHPPHP ^8.1|^8.2|^8.3|^8.4

Since Dec 23Pushed 3mo agoCompare

[ Source](https://github.com/Rstacode/wayl)[ Packagist](https://packagist.org/packages/rstacode/wayl)[ Docs](https://github.com/rstacode/wayl)[ RSS](/packages/rstacode-wayl/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Wayl Laravel Package
====================

[](#wayl-laravel-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f89131991596ede20e043b976db57922b1b51bcda249b1cdde1a856042cf690b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72737461636f64652f7761796c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rstacode/wayl)[![Total Downloads](https://camo.githubusercontent.com/c8d9c3595ec0a636a4e0b3f9d9c206c69d91a3d5d64654ce4194c9249a494605/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72737461636f64652f7761796c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rstacode/wayl)[![License](https://camo.githubusercontent.com/d76a8eeb915ae95bce9154994bda90df24f138b3ebca3be1dcd846d4321a3adc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72737461636f64652f7761796c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rstacode/wayl)

The e-commerce payment platform for Iraq and Middle East. Wayl transforms social media merchants into real businesses.

Wayl provides a simple and powerful Laravel package to create payment links, manage products, handle subscriptions, and process refunds with ease.

Features
--------

[](#features)

- 🚀 **Payment Links**: Create and manage payment links effortlessly
- 📦 **Products**: Retrieve and manage your product catalog
- 🔄 **Subscriptions**: Handle recurring payments and subscriptions
- 👥 **Subscribers**: Track and manage your subscribers
- 💸 **Refunds**: Process refunds with simple API calls
- 📊 **Channels**: Access available payment channels
- 🔐 **Authentication**: Secure API key verification
- ⚡ **Fast &amp; Reliable**: Optimized for performance
- 🛡️ **Exception Handling**: Comprehensive error handling

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

[](#requirements)

- PHP 8.1, 8.2, 8.3, or 8.4
- Laravel 10, 11, 12, or 13

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

[](#installation)

Install the package via Composer:

```
composer require rstacode/wayl
```

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

[](#configuration)

Publish the configuration file:

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

Add your Wayl API key to your `.env` file:

```
WAYL_API_KEY=your_api_key_here
WAYL_BASE_URL=https://api.thewayl.com/api/v1
WAYL_TIMEOUT=30
```

You can get your API key from the [Wayl Dashboard](https://wayl.io).

Usage
-----

[](#usage)

### Verify Authentication Key

[](#verify-authentication-key)

Verify your API key is valid:

```
use Wayl\Facades\Wayl;

$response = Wayl::auth()->verifyKey();
```

**Response:**

```
[
    'data' => [],
    'message' => 'Authenticated successfully'
]
```

### Get Payment Channels

[](#get-payment-channels)

Retrieve all available payment channels:

```
use Wayl\Facades\Wayl;

$channels = Wayl::channels()->all();

foreach ($channels['data'] as $channel) {
    echo $channel['name'];
    echo $channel['icon'];
}
```

**Response:**

```
[
    'data' => [
        [
            'id' => 'channel-123',
            'name' => 'FIB',
            'icon' => 'https://example.com/icon.png'
        ]
    ],
    'message' => 'Success'
]
```

### Create Payment Link

[](#create-payment-link)

Create a new payment link:

```
use Wayl\Facades\Wayl;

$response = Wayl::links()->create([
    'referenceId' => 'order-123',
    'total' => 10000,
    'currency' => 'IQD',
    'customParameter' => '',
    'lineItem' => [
        [
            'label' => 'Product Name',
            'amount' => 10000,
            'type' => 'increase',
            'image' => 'https://example.com/product.jpg'
        ]
    ],
    'webhookUrl' => 'https://your-site.com/webhooks/wayl',
    'webhookSecret' => 'your_webhook_secret',
    'redirectionUrl' => 'https://your-site.com/success'
]);

echo $response['data']['url'];
echo $response['data']['code'];
```

**Response:**

```
[
    'data' => [
        'customParameter' => '',
        'referenceId' => 'order-123',
        'id' => 'cmjicw32o00jnjy089lh5kvri',
        'total' => '10000',
        'currency' => 'IQD',
        'code' => '7G2DG958',
        'paymentMethod' => null,
        'type' => 'Schrödinger',
        'status' => 'Created',
        'completedAt' => null,
        'createdAt' => '2025-12-23T09:01:58.032Z',
        'updatedAt' => '2025-12-23T09:01:58.032Z',
        'url' => 'https://link.thewayl.com/pay?id=cmjicw32o00jnjy089lh5kvri',
        'webhookUrl' => 'https://your-site.com/webhooks/wayl',
        'redirectionUrl' => 'https://your-site.com/success?referenceId=order-123&orderid=cmjicw32o00jnjy089lh5kvri'
    ],
    'message' => 'Done',
    'success' => true
]
```

### Retrieve All Links

[](#retrieve-all-links)

Get all payment links with pagination:

```
use Wayl\Facades\Wayl;

$links = Wayl::links()->all([
    'take' => 10,
    'skip' => 0,
    'statuses' => 'Pending'
]);

foreach ($links['data'] as $link) {
    echo $link['referenceId'];
    echo $link['status'];
    echo $link['total'];
}
```

### Retrieve a Specific Link

[](#retrieve-a-specific-link)

Get a specific link by reference ID:

```
use Wayl\Facades\Wayl;

$link = Wayl::links()->find('order-123');

echo $link['data']['status'];
echo $link['data']['url'];
```

### Invalidate a Link

[](#invalidate-a-link)

Invalidate a payment link:

```
use Wayl\Facades\Wayl;

$response = Wayl::links()->invalidate('order-123');
```

### Invalidate a Link (Only if Pending)

[](#invalidate-a-link-only-if-pending)

Invalidate a link only if its status is pending:

```
use Wayl\Facades\Wayl;

$response = Wayl::links()->invalidateIfPending('order-123');
```

### Batch Retrieve Links

[](#batch-retrieve-links)

Retrieve multiple links by reference IDs:

```
use Wayl\Facades\Wayl;

$response = Wayl::links()->batch([
    'ref-001',
    'ref-002',
    'ref-003'
]);

echo $response['totalRequested'];
echo $response['totalFound'];
```

**Response:**

```
[
    'data' => [...],
    'message' => 'Found 2 links out of 3 requested reference IDs',
    'totalRequested' => 3,
    'totalFound' => 2
]
```

### Retrieve All Products

[](#retrieve-all-products)

Get all products with pagination:

```
use Wayl\Facades\Wayl;

$products = Wayl::products()->all([
    'take' => 10,
    'skip' => 0
]);

foreach ($products['data'] as $product) {
    echo $product['name'];
    echo $product['price'];
    echo $product['status'];
}
```

**Response:**

```
[
    'data' => [
        [
            'id' => 'product-123',
            'name' => 'Product Name',
            'price' => '10000',
            'url' => 'https://example.com/product',
            'status' => 'active',
            'image' => 'https://example.com/image.jpg',
            'tags' => 'tag1,tag2',
            'description' => 'Product description',
            'createdAt' => '2025-12-23T08:42:32.665Z',
            'updatedAt' => '2025-12-23T08:42:32.665Z',
            'productType' => 'physical',
            'qt' => 1,
            'unlimited' => true
        ]
    ],
    'message' => 'Success'
]
```

### Retrieve a Specific Product

[](#retrieve-a-specific-product)

Get a product by ID:

```
use Wayl\Facades\Wayl;

$product = Wayl::products()->find('product-123');

echo $product['data']['name'];
echo $product['data']['price'];
```

### Retrieve All Subscriptions

[](#retrieve-all-subscriptions)

Get all subscriptions with pagination:

```
use Wayl\Facades\Wayl;

$subscriptions = Wayl::subscriptions()->all([
    'take' => 10,
    'skip' => 0
]);

foreach ($subscriptions['data'] as $subscription) {
    echo $subscription['title'];
    echo $subscription['amount'];
    echo $subscription['subscriptionPeriod'];
}
```

**Response:**

```
[
    'data' => [
        [
            'createdAt' => '2025-12-23T08:42:32.665Z',
            'updatedAt' => '2025-12-23T08:42:32.665Z',
            'id' => 'subscription-123',
            'title' => 'Monthly Plan',
            'amount' => '10000',
            'currency' => 'IQD',
            'subscriptionPeriod' => 'Monthly',
            'gracePeriod' => 3,
            'pausedSubscription' => false
        ]
    ],
    'message' => 'Success'
]
```

### Retrieve a Specific Subscription

[](#retrieve-a-specific-subscription)

Get a subscription by ID:

```
use Wayl\Facades\Wayl;

$subscription = Wayl::subscriptions()->find('subscription-123');

echo $subscription['data']['title'];
echo $subscription['data']['amount'];
```

### Retrieve All Subscribers

[](#retrieve-all-subscribers)

Get all subscribers with pagination and filtering:

```
use Wayl\Facades\Wayl;

$subscribers = Wayl::subscribers()->all([
    'take' => 10,
    'skip' => 0,
    'status' => 'Active'
]);

foreach ($subscribers['data'] as $subscriber) {
    echo $subscriber['status'];
    echo $subscriber['nextBillingAt'];
    echo $subscriber['customer']['name'];
}
```

**Response:**

```
[
    'data' => [
        [
            'id' => 'subscriber-123',
            'createdAt' => '2025-12-23T08:42:32.665Z',
            'updatedAt' => '2025-12-23T08:42:32.665Z',
            'amount' => 10000,
            'currency' => 'IQD',
            'period' => 'Monthly',
            'status' => 'Active',
            'nextBillingAt' => '2025-01-23T08:42:32.665Z',
            'pendingAmount' => 0,
            'retryCount' => 0,
            'product' => [
                'id' => 'product-123',
                'title' => 'Monthly Plan',
                'price' => 10000,
                'subscriptionPeriod' => 'Monthly'
            ],
            'customer' => [
                'id' => 'customer-123',
                'name' => 'John Doe',
                'email' => 'john@example.com',
                'phone' => '9647501234567'
            ]
        ]
    ],
    'message' => 'Success'
]
```

### Create a Refund

[](#create-a-refund)

Create a refund request:

```
use Wayl\Facades\Wayl;

$response = Wayl::refunds()->create([
    'referenceId' => 'order-123',
    'reason' => 'Customer requested refund',
    'amount' => 5000
]);
```

### Retrieve All Refunds

[](#retrieve-all-refunds)

Get all refunds with filtering:

```
use Wayl\Facades\Wayl;

$refunds = Wayl::refunds()->all([
    'referenceId' => 'order-123',
    'take' => 10,
    'skip' => 0,
    'statuses' => 'Requested'
]);

foreach ($refunds['data'] as $refund) {
    echo $refund['reason'];
    echo $refund['amount'];
    echo $refund['status'];
}
```

**Response:**

```
[
    'data' => [
        [
            'id' => 'refund-123',
            'reason' => 'Customer requested refund',
            'linkId' => 'link-123',
            'referenceId' => 'order-123',
            'amount' => 5000,
            'initiatedBy' => 'merchant',
            'status' => 'Requested'
        ]
    ],
    'message' => 'Success'
]
```

### Retrieve a Specific Refund

[](#retrieve-a-specific-refund)

Get a refund by ID:

```
use Wayl\Facades\Wayl;

$refund = Wayl::refunds()->find('refund-123');

echo $refund['data']['status'];
echo $refund['data']['amount'];
```

### Cancel a Refund

[](#cancel-a-refund)

Cancel a refund request:

```
use Wayl\Facades\Wayl;

$response = Wayl::refunds()->cancel('refund-123');
```

Dependency Injection
--------------------

[](#dependency-injection)

You can also use dependency injection instead of the Facade:

```
use Wayl\Wayl;

class PaymentController extends Controller
{
    public function __construct(protected Wayl $wayl)
    {
    }

    public function createPayment()
    {
        return $this->wayl->links()->create([
            'referenceId' => 'order-123',
            'total' => 10000,
            'currency' => 'IQD',
        ]);
    }
}
```

Error Handling
--------------

[](#error-handling)

The package provides comprehensive error handling through the `WaylException` class:

```
use Wayl\Facades\Wayl;
use Wayl\Exceptions\WaylException;

try {
    $response = Wayl::links()->create([
        'referenceId' => 'order-123',
        'total' => 10000,
        'currency' => 'IQD',
    ]);
} catch (WaylException $e) {
    $message = $e->getMessage();
    $code = $e->getCode();
    $response = $e->getResponse();

    // Handle the error
    logger()->error('Wayl API Error', [
        'message' => $message,
        'code' => $code,
        'response' => $response
    ]);
}
```

### Available Exception Methods

[](#available-exception-methods)

- `getMessage()` - Get the error message
- `getCode()` - Get the HTTP status code
- `getResponse()` - Get the full API response data

API Reference
-------------

[](#api-reference)

### Links

[](#links)

MethodDescription`create(array $data)`Create a new payment link`all(array $params = [])`Retrieve all links with pagination`find(string $referenceId)`Retrieve a specific link`invalidate(string $referenceId)`Invalidate a link`invalidateIfPending(string $referenceId)`Invalidate a link if pending`batch(array $referenceIds)`Retrieve multiple links### Products

[](#products)

MethodDescription`all(array $params = [])`Retrieve all products`find(string $productId)`Retrieve a specific product### Subscriptions

[](#subscriptions)

MethodDescription`all(array $params = [])`Retrieve all subscriptions`find(string $subscriptionId)`Retrieve a specific subscription### Subscribers

[](#subscribers)

MethodDescription`all(array $params = [])`Retrieve all subscribers### Refunds

[](#refunds)

MethodDescription`create(array $data)`Create a refund request`all(array $params = [])`Retrieve all refunds`find(string $refundId)`Retrieve a specific refund`cancel(string $refundId)`Cancel a refund request### Authentication

[](#authentication)

MethodDescription`verifyKey()`Verify the API key### Channels

[](#channels)

MethodDescription`all()`Retrieve all payment channelsSupport
-------

[](#support)

- **Website**: [wayl.io](https://wayl.io)
- **API Documentation**: [api.thewayl.com](https://api.thewayl.com)
- **Issues**: [GitHub Issues](https://github.com/rstacode/wayl/issues)

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Rstacode](https://github.com/rstacode)
- [All Contributors](https://github.com/rstacode/wayl/contributors)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance80

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~43 days

Total

3

Last Release

106d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35005761?v=4)[Nashwan Abdullah](/maintainers/codenashwan)[@codenashwan](https://github.com/codenashwan)

---

Top Contributors

[![codenashwan](https://avatars.githubusercontent.com/u/35005761?v=4)](https://github.com/codenashwan "codenashwan (6 commits)")

---

Tags

credit-cardfastpayfibiraqkurdistanmastercardpaymentpayment-gatewaypayment-integrationpayment-processingpaymentmethodspaymentsqicardvisavisacardwaylwayliowayliraqlaravelsdkpaymente-commerceiraqwayl

### Embed Badge

![Health badge](/badges/rstacode-wayl/health.svg)

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M885](/packages/laravel-socialite)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4851.0k](/packages/sebdesign-laravel-viva-payments)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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