PHPackages                             sophada/s-payway-php-sdk - 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. sophada/s-payway-php-sdk

Active[Payment Processing](/categories/payments)

sophada/s-payway-php-sdk
========================

00PHP

Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sophada/S-PayWay-PHP-SDK)[ Packagist](https://packagist.org/packages/sophada/s-payway-php-sdk)[ RSS](/packages/sophada-s-payway-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersionsUsed By (0)

S-PayWay API Integration
========================

[](#s-payway-api-integration)

A lightweight, framework-agnostic PHP client for the S-PayWay payment gateway API. This library makes it easy to integrate S-PayWay payments into any PHP application.

Features
--------

[](#features)

- Simple and intuitive API
- Framework-agnostic (works with any PHP framework)
- Minimal dependencies
- Handles server timestamp synchronization automatically
- Securely generates signatures for API requests
- Built-in debugging capabilities

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

[](#requirements)

- PHP 5.4 or higher (compatible with PHP 8.3+)
- cURL extension
- JSON extension
- hash extension

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

[](#installation)

1. Download the latest release from GitHub
2. Include the Gateway class in your project:

```
require_once 'path/to/src/S_PayWay/Gateway.php';
```

Quick Start
-----------

[](#quick-start)

```
// Import the Gateway class
use S_PayWay\Gateway;

// Initialize the gateway with your credentials
$gateway = new Gateway(
    'your_merchant_id',
    'your_api_key',
    'your_private_key',
);

// Set up your payment parameters
$params = [
    'goods' => [
        'reference_id'  => 'ORD-' . uniqid(),
        'name'          => 'Mobile Legends Bang Bang Diamonds',
        'description'   => 'Instant Recharge',
        'quantity'      => (float) 25,
        'unit_price'    => (double) 1.00,
    ],
    'customer' => [
        'id'        => 'Premium_user',
        'fullname'  => 'John Kh',
        'email'     => 'john.kh@example.com'
    ],
    'paid_url' => 'https://yourwebsite.com/success.php',
    'cancel_url' => 'https://yourwebsite.com/cancel.php',
    'config'        => [
        "timeout"   => 2,
        'version'   => '2.0.0',
    ],
];

// Process the payment
$result = $gateway->createINV($params);

// Check the result
if ($result['success']) {
    // Redirect to payment page
    header('Location: ' . $result['payment_url']);
    exit;
} else {
    // Handle error
    echo 'Payment failed: ' . $result['message'];
}
```

Framework Compatibility
-----------------------

[](#framework-compatibility)

This library works with all popular PHP frameworks including:

FrameworkCompatible VersionsLaravel5.x - 12.x (latest)Symfony3.x - 6.x (latest)CodeIgniter3.x - 4.x (latest)CakePHP3.x - 5.x (latest)Yii1.x - 2.x (latest)Laminas/ZendAll versionsSlim3.x - 4.x (latest)WordPress5.x and aboveMagento1.x - 2.x (latest)Drupal7.x - 10.x (latest)PrestaShop1.6.x - 8.x (latest)OpenCart2.x - 4.x (latest)Custom PHP ProjectsAllFramework Integration Examples
------------------------------

[](#framework-integration-examples)

### Laravel

[](#laravel)

```
// In a controller
public function checkout(Request $request)
{
    $gateway = new \S_PayWay\Gateway(
        config('services.s_payway.merchant_id'),
        config('services.s_payway.api_key')
        config('services.s_payway.private_key'),
    );

    $params = [
        'goods' => [
            'reference_id' => 'ORD-' . $request->order_id,
            // Other params...
        ],
        // Rest of the params...
    ];

    $result = $gateway->createINV($params);

    if ($result['success']) {
        return redirect($result['payment_url']);
    } else {
        return back()->with('error', $result['message']);
    }
}
```

### WordPress

[](#wordpress)

```
function process_s_payway_payment() {
    // Include the Gateway class
    require_once plugin_dir_path(__FILE__) . 'includes/class-s-payway-gateway.php';

    $gateway = new \S_PayWay\Gateway(
        get_option('s_payway_merchant_id'),
        get_option('s_payway_api_key')
        get_option('s_payway_private_key'),
    );

    // Rest of the code...
}
```

Advanced Usage
--------------

[](#advanced-usage)

### Enabling Debug Mode

[](#enabling-debug-mode)

```
$gateway->setDebug(true);
```

### Callback Handling

[](#callback-handling)

Implement a callback handler to receive payment notifications:

```
// callback.php
$rawData = file_get_contents('php://input');
$headers = getallheaders();

$signature = $headers['S-PayWay-Signature'] ?? '';
$timestamp = $headers['S-PayWay-Timestamp'] ?? '';
$merchantId = $headers['S-PayWay-Merchant-ID'] ?? '';

// Verify the signature
$expectedSignature = hash_hmac(
    'sha256',
    $timestamp . ':' . $rawData,
    'your_private_key'
);

if (hash_equals($expectedSignature, $signature)) {
    // Process the callback
    $callbackData = json_decode($rawData, true);

    // Update order status in your database
    // ...

    http_response_code(200);
    echo json_encode(['status' => 'success']);
} else {
    http_response_code(401);
    echo json_encode(['status' => 'error', 'message' => 'Invalid signature']);
}
```

Security
--------

[](#security)

- Never expose your private key or API key in client-side code
- Always validate and sanitize user inputs
- Use HTTPS for all API communications
- Store API credentials securely (e.g., in environment variables)
- Implement proper callback signature verification

License
-------

[](#license)

MIT License

Credits
-------

[](#credits)

Developed and maintained by S-SERVER Pvt LTD

Support
-------

[](#support)

For support, please open an issue on GitHub or contact .

###  Health Score

12

—

LowBetter than 1% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity8

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b89977b6c83ad09bdae1d7e9d7b858a6cdaa4c2af69924b0301a550da30493b?d=identicon)[sophada](/maintainers/sophada)

---

Top Contributors

[![sophada](https://avatars.githubusercontent.com/u/65668798?v=4)](https://github.com/sophada "sophada (33 commits)")

### Embed Badge

![Health badge](/badges/sophada-s-payway-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/sophada-s-payway-php-sdk/health.svg)](https://phpackages.com/packages/sophada-s-payway-php-sdk)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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