PHPackages                             xplicit-dev/mamopay - 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. [API Development](/categories/api)
4. /
5. xplicit-dev/mamopay

ActiveLibrary[API Development](/categories/api)

xplicit-dev/mamopay
===================

The MamoPay PHP library provides convenient access to the MamoPay API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the MamoPay API.

2.1(7mo ago)21.0k↓100%MITPHPPHP &gt;=5.6.0

Since Jan 6Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/xplicit-dev/mamopay)[ Packagist](https://packagist.org/packages/xplicit-dev/mamopay)[ Docs](https://github.com/xplicit-dev/mamopay)[ RSS](/packages/xplicit-dev-mamopay/feed)WikiDiscussions master Synced today

READMEChangelog (4)DependenciesVersions (6)Used By (0)

MamoPay
=======

[](#mamopay)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cd7e89820fe322724f1fdbb796df66e5acf7011a3a24a8eee71dddb503b3187a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f78706c696369742d6465762f4d616d6f5061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xplicit-dev/MamoPay) [![Total Downloads](https://camo.githubusercontent.com/3af00abf48a720141874ad4179af45c290823b2ac617bb2a649f104472c2996d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f78706c696369742d6465762f4d616d6f5061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xplicit-dev/MamoPay)

The MamoPay PHP library offers seamless integration with the MamoPay API for PHP-based applications, streamlining access and enhancing functionality.

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

[](#requirements)

A minimum of PHP 5.6.0 up to 8.1

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

[](#installation)

You can install the package via Composer:

```
composer require xplicit-dev/mamopay
```

Getting Started
===============

[](#getting-started)

Obtain your API Key:

Log in to the MamoPay dashboard ()

and navigate to the Developer section to get your API key.

Instantiate MamoPay Client:

```
use MamoPay\Api\MamoClient;

$client = (new MamoClient('API_KEY'));
```

For sandbox testing, pass 'true' as second parameter:

```
$client = (new MamoClient('API_KEY',true));
```

The resources can be accessed via the `$client` object. All the methods invocations follow the following pattern

```
// $client->class()->function() to access the API

//Example

$client->links()->get($linkId);
```

Supported Resources
===================

[](#supported-resources)

- [Links](#links-section)
- [Transaction](#transaction-section)
- [Subscription](#subscription-section)
- [Payout](#payout-section)
- [Webhook](#webhook-section)
- [Recipient](#recipient-section)
- [Card](#card-section)

### Use of Unlisted Resources

[](#use-of-unlisted-resources)

The MamoClient SDK allows you to utilize resources not listed within this package. This flexibility enables you to leverage any additional resources provided by the MamoPay API without constraints.

```
use MamoPay\Api\MamoClient;

$client = (new MamoClient('API_KEY'));
$params = ['card_id' => $card_id, 'amount' => $amount, 'currency' => $currency];
$response = $client->httpClient->sendRequest('end_point',$params,HttpClient::METHOD_POST);
```

Links
-----------------------------------------------

[](#links-)

The resource to generate vanilla and subscription payment links

- generate vanilla payment link:

see params here [https://mamopay.readme.io/reference/post\_links](https://mamopay.readme.io/reference/post_links)

```
$params = ['is_widget' => true , 'save_card'=>true];

$response = $client->links()->create($title,$amount,$returnUrl,$params);
```

this will return a \\MamoPay\\Api\\Objects\\PaymentLink object

refer:

```
$id = $response->id;

$payment_url = $response->payment_url;
```

- Fetching all Payment Links:

```
$client->links()->all();
```

- Update Payment Link:

```
$client->links()->update($linkID,$params);
```

- Delete Payment Link:

```
$client->links()->delete($linkID);
```

- Fetch Payment Link Info:

```
$client->links()->get($linkID);
```

Transaction
-----------------------------------------------------------

[](#transaction-)

Initiate transactions by merchant (Merchant Initiated Transaction)

Merchant Initiated Transactions (MIT) allows a business to use card details, that were stored during previous transactions, to charge their customers.

```
$charge = $client->transaction()->create($card_id,$amount);
```

this will return a \\MamoPay\\Api\\Objects\\TransactionInfo object

refer :

```
$chargeID = $charge->id;
```

- Fetch Transaction Info

```
$client->transaction()->get($chargeID);
```

- Fetch all Transactions

```
$client->transaction()->all();
```

- Refund Payment

```
$client->transaction()->refund($chargeId,$amount);
```

Subscription
-------------------------------------------------------------

[](#subscription-)

- Fetches all subscribers of subscription.

```
$client->subscription()->all($subscriptionId);
```

- Fetches all subscription payments made against a Recurring Payment item.

```
$client->subscription()->get($subscriptionId);
```

- Unsubscribe subscription

```
$client->subscription()->unSubscribe($subscriptionId,$subscriberId);
```

- Cancels an existing recurring payment. This is NOT to unsubscribe a customer from a recurring payment that they have subscribed to. This deletes a previously created subscription for a business.

```
$client->subscription()->cancelRecurring($subscriptionId);
```

Payout
-------------------------------------------------

[](#payout-)

- Fetch all Disbursements

```
$client->payout()->all();
```

Issue Disbursements

- Allows the issuance of disbursement

```
$client->payout()->issue($account_no, $amount, $first_name, $last_name = '', $reason = '', $transfer_method = 'BANK_ACCOUNT');
```

- Allows the issuance of disbursements in bulk

```
