PHPackages                             hypertech/paysuite-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. hypertech/paysuite-php-sdk

ActiveLibrary

hypertech/paysuite-php-sdk
==========================

Paysuite client API SDK

2.3.0(1y ago)2418↓50%1[1 issues](https://github.com/hypertech-lda/paysuite-php-sdk/issues)Apache-2.0PHPPHP &gt;=7.4CI failing

Since Oct 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hypertech-lda/paysuite-php-sdk)[ Packagist](https://packagist.org/packages/hypertech/paysuite-php-sdk)[ Docs](https://packagist.org/packages/hypertech/paysuite-php-sdk)[ RSS](/packages/hypertech-paysuite-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

How to Use the PaySuite PHP SDK
-------------------------------

[](#how-to-use-the-paysuite-php-sdk)

The `paysuite-php-sdk` library allows you to process payments quickly and easily using payment methods available in Mozambique, such as Mpesa, eMola, PayPal, and bank transfers.

### Installation

[](#installation)

1. Create an account at [Paysuite.tech](https://paysuite.tech) and obtain your access token from the dashboard
2. Install the library using Composer:

```
composer require hypertech/paysuite-php-sdk
```

### Basic Usage

[](#basic-usage)

First, import and initialize the client with your token:

```
use Hypertech\Paysuite\Client;
use Hypertech\Paysuite\Exception\ValidationException;
use Hypertech\Paysuite\Exception\PaysuiteException;

$token = "your-access-token";
$client = new Client($token);
```

#### Create a Payment

[](#create-a-payment)

```
try {
    $response = $client->createPayment([
        'amount' => '100.50',
        'reference' => 'INV123',
        'description' => 'Invoice payment',
        'return_url' => 'https://yoursite.com/return',
        'callback_url' => 'https://yoursite.com/callback'
    ]);

    if ($response->isSuccessfully()) {
        // Get the checkout URL to redirect the customer
        $checkoutUrl = $response->getCheckoutUrl();

        // Get the payment ID for later reference
        $paymentId = $response->getId();

        // Redirect customer to payment page
        header("Location: " . $checkoutUrl);
        exit;
    }
} catch (ValidationException $e) {
    // Handle validation errors
    echo "Validation error: " . $e->getMessage();
} catch (PaysuiteException $e) {
    // Handle API errors
    echo "API error: " . $e->getMessage();
}
```

#### Check Payment Status

[](#check-payment-status)

```
try {
    $response = $client->getPayment($paymentId);

    if ($response->isSuccessfully()) {
        $status = $response->getData()['status'];

        // Check if transaction data is available
        if (isset($response->getData()['transaction'])) {
            $transaction = $response->getData()['transaction'];
            $transactionId = $transaction['id'];
            $paidAt = $transaction['paid_at'];
        }
    }
} catch (ValidationException $e) {
    echo "Validation error: " . $e->getMessage();
} catch (PaysuiteException $e) {
    echo "API error: " . $e->getMessage();
}
```

### Validation Rules

[](#validation-rules)

The SDK implements comprehensive validation for all API requests:

1. **Payment Request Validation**:

    - `amount`: Must be a positive number
    - `reference`: Required string
    - `description`: Optional string
    - `return_url`: Must be a valid URL
    - `callback_url`: Must be a valid URL
2. **UUID Validation**:

    - Payment IDs must follow the standard UUID format (8-4-4-4-12 hexadecimal characters)
    - Example: `550e8400-e29b-41d4-a716-446655440000`

### Response Handling

[](#response-handling)

The `Response` class provides convenient methods to access payment data:

```
// Check if the request was successful
$isSuccess = $response->isSuccessfully();

// Get the full response content
$content = $response->getContent();

// Get just the data portion of the response
$data = $response->getData();

// Get specific fields with helper methods
$reference = $response->getReference();
$amount = $response->getAmount();
$checkoutUrl = $response->getCheckoutUrl();

// Get error message if request failed
$errorMessage = $response->getMessage();
```

### Error Handling

[](#error-handling)

The SDK includes two main types of exceptions:

- `ValidationException`: For input validation errors (missing fields, invalid values)
- `PaysuiteException`: For API errors (authentication, server errors, etc.)

Error responses include:

- HTTP 400: Bad Request (validation errors)
- HTTP 401: Unauthorized (invalid token)
- HTTP 404: Not Found (invalid payment ID)
- HTTP 500: Server Error

### Running Tests

[](#running-tests)

Configure your test token in the `phpunit.xml` file or via environment variable:

```
export TOKEN="your-test-token"
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more details.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.

### Security

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

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 ~143 days

Total

5

Last Release

382d ago

Major Versions

1.0.0 → 2.0.02025-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc1132a3e4d77cdbacfc1b3f51d5b05273895a4f25f9ddcd5d1ebd56468f0978?d=identicon)[karson](/maintainers/karson)

---

Top Contributors

[![karson](https://avatars.githubusercontent.com/u/755840?v=4)](https://github.com/karson "karson (18 commits)")

---

Tags

emolampesapaymentspayments-platformphpsdkpayment gatewaympesaemolapaysuite clientsdk payment

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hypertech-paysuite-php-sdk/health.svg)

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

###  Alternatives

[shetabit/payment

Laravel Payment Gateway Integration Package

944330.1k5](/packages/shetabit-payment)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

39881.3k6](/packages/cybersource-rest-client-php)[jomweb/billplz

PHP Agnostic library for working with BillPlz API

77199.0k3](/packages/jomweb-billplz)[coinpaymentsnet/coinpayments-php

A PHP wrapper for the CoinPayments.net v1 API.

55126.2k](/packages/coinpaymentsnet-coinpayments-php)

PHPackages © 2026

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