PHPackages                             nkwa-pay/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. nkwa-pay/sdk

ActiveLibrary

nkwa-pay/sdk
============

v0.1.5(10mo ago)015↓100%MITPHPPHP ^8.2CI failing

Since Apr 21Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/nkwa/pay-php)[ Packagist](https://packagist.org/packages/nkwa-pay/sdk)[ RSS](/packages/nkwa-pay-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (10)Versions (7)Used By (0)

pay-php
=======

[](#pay-php)

Nkwa Pay SDK for PHP

Summary
-------

[](#summary)

Nkwa Pay API: Use this API to integrate mobile money across your payment flows, create and manage payments, collections, and disbursements.

Read the docs at

Table of Contents
-----------------

[](#table-of-contents)

- [pay-php](#pay-php)
    - [SDK Installation](#sdk-installation)
    - [SDK Example Usage](#sdk-example-usage)
    - [Authentication](#authentication)
    - [Available Resources and Operations](#available-resources-and-operations)
    - [Error Handling](#error-handling)
    - [Server Selection](#server-selection)

SDK Installation
----------------

[](#sdk-installation)

The SDK relies on [Composer](https://getcomposer.org/) to manage its dependencies.

To install the SDK and add it as a dependency to an existing `composer.json` file:

```
composer require "nkwa-pay/sdk"
```

SDK Example Usage
-----------------

[](#sdk-example-usage)

### Example

[](#example)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Pay;

$sdk = Pay\Pay::builder()
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->payments->get(
    id: 'b888f774-3e7c-4135-a18c-6b985523c4bc'
);

if ($response->payment !== null) {
    // handle response
}
```

Authentication
--------------

[](#authentication)

### Per-Client Security Schemes

[](#per-client-security-schemes)

This SDK supports the following security scheme globally:

NameTypeScheme`apiKeyAuth`apiKeyAPI keyTo authenticate with the API the `apiKeyAuth` parameter must be set when initializing the SDK. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Pay;

$sdk = Pay\Pay::builder()
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->payments->get(
    id: 'b888f774-3e7c-4135-a18c-6b985523c4bc'
);

if ($response->payment !== null) {
    // handle response
}
```

Available Resources and Operations
----------------------------------

[](#available-resources-and-operations)

Available methods### [operators](docs/sdks/operators/README.md)

[](#operators)

#### [operators-&gt;availability](docs/sdks/availability/README.md)

[](#operators-availability)

- [get](docs/sdks/availability/README.md#get) - Check which operators and operations are currently available.

### [payments](docs/sdks/payments/README.md)

[](#payments)

- [get](docs/sdks/payments/README.md#get) - Get the payment (collection or disbursement) with the specified ID.
- [collect](docs/sdks/payments/README.md#collect) - Collect a payment from a phone number.
- [disburse](docs/sdks/payments/README.md#disburse) - Disburse a payment from your balance to a phone number.

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

[](#error-handling)

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default an API error will raise a `Errors\APIException` exception, which has the following properties:

PropertyTypeDescription`$message`*string*The error message`$statusCode`*int*The HTTP status code`$rawResponse`*?\\Psr\\Http\\Message\\ResponseInterface*The raw HTTP response`$body`*string*The response contentWhen custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `get` method throws the following exceptions:

Error TypeStatus CodeContent TypeErrors\\HttpError401, 404application/jsonErrors\\HttpError500application/jsonErrors\\APIException4XX, 5XX\*/\*### Example

[](#example-1)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Pay;
use Pay\Models\Errors;

$sdk = Pay\Pay::builder()
    ->setSecurity(
        ''
    )
    ->build();

try {
    $response = $sdk->payments->get(
        id: 'b888f774-3e7c-4135-a18c-6b985523c4bc'
    );

    if ($response->payment !== null) {
        // handle response
    }
} catch (Errors\HttpErrorThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\HttpErrorThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\APIException $e) {
    // handle default exception
    throw $e;
}
```

Server Selection
----------------

[](#server-selection)

### Override Server URL Per-Client

[](#override-server-url-per-client)

The default server can be overridden globally using the `setServerUrl(string $serverUrl)` builder method when initializing the SDK client instance. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Pay;

$sdk = Pay\Pay::builder()
    ->setServerURL('https://api.pay.staging.mynkwa.com')
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->payments->get(
    id: 'b888f774-3e7c-4135-a18c-6b985523c4bc'
);

if ($response->payment !== null) {
    // handle response
}
```

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance53

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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 ~3 days

Total

5

Last Release

323d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d5343b8f1392d1c42781a29a354eb6f4f4ba5d4053bf7bf78e83201d0f0c97d?d=identicon)[leroi1](/maintainers/leroi1)

---

Top Contributors

[![Ebaneck](https://avatars.githubusercontent.com/u/10956602?v=4)](https://github.com/Ebaneck "Ebaneck (9 commits)")[![speakeasybot](https://avatars.githubusercontent.com/u/108416695?v=4)](https://github.com/speakeasybot "speakeasybot (1 commits)")[![speakeasy-github[bot]](https://avatars.githubusercontent.com/in/308252?v=4)](https://github.com/speakeasy-github[bot] "speakeasy-github[bot] (1 commits)")

---

Tags

nkwaphpsdk

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nkwa-pay-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/nkwa-pay-sdk/health.svg)](https://phpackages.com/packages/nkwa-pay-sdk)
```

###  Alternatives

[clerkinc/backend-php

2736.3k](/packages/clerkinc-backend-php)[polar-sh/sdk

419.9k3](/packages/polar-sh-sdk)

PHPackages © 2026

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