PHPackages                             mavunta/mavunta-php - 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. mavunta/mavunta-php

ActiveLibrary[Payment Processing](/categories/payments)

mavunta/mavunta-php
===================

Official PHP SDK for the Mavunta Pay API.

v1.1.0(1mo ago)001MITPHPPHP &gt;=8.1CI passing

Since Jul 3Pushed 1mo agoCompare

[ Source](https://github.com/mavunta/mavunta-php)[ Packagist](https://packagist.org/packages/mavunta/mavunta-php)[ Docs](https://developers.mavunta.com)[ RSS](/packages/mavunta-mavunta-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (1)

mavunta/mavunta-php
===================

[](#mavuntamavunta-php)

Official PHP SDK for the [Mavunta Pay API](https://developers.mavunta.com). No third-party dependencies (ext-curl + ext-json), PHP 8.1+.

```
composer require mavunta/mavunta-php
```

Quickstart
----------

[](#quickstart)

Create an intent, redirect the customer to its hosted checkout, and fulfil the order on the signed `payment_intent.paid` webhook.

```
use Mavunta\Mavunta;

$mavunta = new Mavunta(['apiKey' => getenv('MAVUNTA_SECRET_KEY')]);

$intent = $mavunta->paymentIntents->create([
    'amount' => '2500',
    'currency' => 'KES',
    'settlement_currency' => 'USDT',
    'payment_methods' => ['mpesa', 'card', 'mavunta_balance'],
    'merchant_reference' => 'ORDER-1001',
]);

header('Location: ' . $intent['checkout_url']);
```

A `cwk_test_…` key runs in sandbox (no real money); a `cwk_live_…` key is live. Every create call sends an `Idempotency-Key` automatically, so an automatic retry (on 429/5xx) never double-charges.

Resources
---------

[](#resources)

```
$mavunta->auth->verify();
$mavunta->rates->retrieve();
$mavunta->quotes->create(['source_currency' => 'KES', 'target_asset' => 'USDT', 'amount' => '2500']);

$mavunta->paymentIntents->create($params, ['idempotencyKey' => 'order-1001']);
$mavunta->paymentIntents->retrieve('pi_...');
$mavunta->paymentIntents->all(['limit' => 20, 'status' => 'paid']);
$mavunta->paymentIntents->cancel('pi_...');
$mavunta->paymentIntents->refundRequest('pi_...', ['reason' => 'Customer returned item']);

$mavunta->paymentLinks->create(['title' => 'Deposit', 'amount' => '15000', 'currency' => 'KES']);
$mavunta->paymentLinks->retrieve('pl_...');
```

Verify webhooks
---------------

[](#verify-webhooks)

Pass the **raw** request body.

```
$payload = file_get_contents('php://input');

try {
    $event = $mavunta->webhooks->verify(
        $payload,
        $_SERVER['HTTP_MAVUNTA_SIGNATURE'],
        $_SERVER['HTTP_MAVUNTA_TIMESTAMP'],
        getenv('MAVUNTA_WEBHOOK_SECRET')
    );
    if ($event['type'] === 'payment_intent.paid') {
        // fulfil the order (dedupe on $event['id'])
    }
    http_response_code(200);
} catch (\Mavunta\MavuntaError $e) {
    http_response_code(400);
}
```

Errors
------

[](#errors)

```
try {
    $mavunta->paymentIntents->create(['amount' => '0', 'currency' => 'KES']);
} catch (\Mavunta\MavuntaError $e) {
    error_log($e->type . ' ' . $e->apiCode . ' ' . $e->getMessage() . ' ' . $e->getRequestId());
}
```

The full contract is published as OpenAPI at .

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

49d ago

### Community

Maintainers

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

---

Tags

cryptopaymentspayment gatewaympesaUSDTmavunta

### Embed Badge

![Health badge](/badges/mavunta-mavunta-php/health.svg)

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

###  Alternatives

[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

40975.8k6](/packages/cybersource-rest-client-php)[knox/pesapal

A laravel package that integrates into the pesapal api

29123.8k](/packages/knox-pesapal)[razorpay/magento

Razorpay Magento 2.0 plugin for accepting payments.

3080.1k1](/packages/razorpay-magento)[itsmurumba/laravel-mpesa

Laravel Package for Mpesa Daraja API

2011.1k](/packages/itsmurumba-laravel-mpesa)[prevailexcel/laravel-nowpayments

A Laravel Package for NOWPayments

1421.1k](/packages/prevailexcel-laravel-nowpayments)[karson/mpesa-php-sdk

172.6k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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