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

ActiveLibrary[Payment Processing](/categories/payments)

cashmos/cashmos-php-api
=======================

Online Payment Processor

v1.0.1(6y ago)0240[1 issues](https://github.com/cashmos/cashmos-php-api/issues)[13 PRs](https://github.com/cashmos/cashmos-php-api/pulls)MITPHP

Since Jun 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/cashmos/cashmos-php-api)[ Packagist](https://packagist.org/packages/cashmos/cashmos-php-api)[ RSS](/packages/cashmos-cashmos-php-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (4)Versions (16)Used By (0)

PHP API for Cashmos Payments
----------------------------

[](#php-api-for-cashmos-payments)

The is the official PHP SDK for Cashmos Payment Processing.

### Installation

[](#installation)

The SDK can be easily installed using [composer](https://getcomposer.org/). To install, run the following command on your terminal or command prompt on Windows (make sure composer is installed and available in your project directory).

```
composer require cashmos/cashmos-php-api
```

If you don't want to use composer, you may directly download a zip file from among the releases.

### Authentication &amp; Cashmos Services

[](#authentication--cashmos-services)

To consume any of the services offered by this SDK, you'll need the `client id` and `secret` for your business account. These can be viewed under the API tab of your business screen of Cashmos online. Create a business at [Cashmos.com](https://cashmos.herokuapp.com) if you don't already have an account.

```
$cashmos = new Cashmos\Cashmos($clientId, $secret);
```

### Order Processing

[](#order-processing)

Use the following steps to process an order with Cashmos:

I. Create an order:

```
  $order = new Cashmos\Services\Order\Order();

  // Add items to order

  $order->addItem(
       new Cashmos\Services\Order\Item($name, $unitPrice, $quantity, $description),
  );

  $order->addItem(
      new Cashmos\Services\Order\Item($name2, $unitPrice2, $quantity2, $description2),
  );

  // Set order total.
  // Note that this is the total amount to be charged to the user.
  // Cashmos does not do any item level calculations for total amount.

  $order->setOrderTotal($orderTotal)

  // You can add any custom data to the order which
  // could be retrieved later after confirmation.
  // This may be information used to identify the customer
  // making the order, etc.
  $customData = [
    'foo' => 'bar'
  ];
  $order->addCustomData($customData);

  // Set return and cancel urls

  $order->returnUrl('https://business.com/paid'); // Url when payment authorization was successful.
  $order->cancelUrl('https://business.com/canceled'); // Url when payment authorization was canceled.
```

II. Process Order Authorization:

This step allows the user to choose their payment method and provide authorization for the purchase. However, the user's is NOT actually charged. Use the next step to confirm the order and actually charge the user.

```
   $cashmos = new Cashmos\Cashmos($clientId, $secret);
   $cashmos->process($order);
```

If the user authorizes the payment, Cashmos will return to the "returnUrl" provided with a payment token as a query parameter (?token="random-token"). This payment token is used to confirm the payment.

III. Confirm Order:

```
 $confirmation = new Cashmos\Services\Order\OrderConfirmation($token);
 $cashmos = new Cashmos\Cashmos($clientId, $secret);

 if($cashmos->process($confirmation)){
     // Order confirmed successfully.
     // You can get any custom data after the order is confirmed.
     $customData = $confirmation->getCustomData();
 }else{
     // There was an error with order confirmation
     echo $cashmos->getError();
 }
```

### Prerequisites

[](#prerequisites)

- PHP 5.3 or above
- [curl](https://secure.php.net/manual/en/book.curl.php) and [openssl](https://secure.php.net/manual/en/book.openssl.php)extensions.

### Security Vulnerabilities

[](#security-vulnerabilities)

If you discover a security vulnerability in this API, please email the details of the vulnerability to .

### License

[](#license)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

2

Last Release

2471d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/906b5b3e6722af9d18692b4eba2b2ba01521abdf70075b956d8b84511b15aa66?d=identicon)[brightantwiboasiako](/maintainers/brightantwiboasiako)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4845.9k](/packages/sebdesign-laravel-viva-payments)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[henryejemuta/laravel-monnify

A laravel package to seamlessly integrate monnify api within your laravel application

132.1k](/packages/henryejemuta-laravel-monnify)

PHPackages © 2026

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