PHPackages                             ayubirz/perfect-money-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. [API Development](/categories/api)
4. /
5. ayubirz/perfect-money-api

ActiveLibrary[API Development](/categories/api)

ayubirz/perfect-money-api
=========================

This package lets you easily integrate PerfectMoney API into your PHP application.

271.4k↓85.7%10[1 issues](https://github.com/AyubIRZ/PerfectMoneyAPI/issues)PHP

Since Dec 8Pushed 3y ago2 watchersCompare

[ Source](https://github.com/AyubIRZ/PerfectMoneyAPI)[ Packagist](https://packagist.org/packages/ayubirz/perfect-money-api)[ RSS](/packages/ayubirz-perfect-money-api/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PerfectMoneyAPI
===============

[](#perfectmoneyapi)

[![Latest Stable Version](https://camo.githubusercontent.com/ece4cd6dad29b24ec8e4d5268745ff008e25e0539938a955ecf6632381291f7f/68747470733a2f2f706f7365722e707567782e6f72672f6179756269727a2f706572666563742d6d6f6e65792d6170692f762f737461626c65)](https://packagist.org/packages/ayubirz/perfect-money-api) [![Total Downloads](https://camo.githubusercontent.com/2124587c21595111c57cb1999e2d1c913973b875d34eff4f00416a81926e9e2b/68747470733a2f2f706f7365722e707567782e6f72672f6179756269727a2f706572666563742d6d6f6e65792d6170692f646f776e6c6f616473)](https://packagist.org/packages/ayubirz/perfect-money-api) [![Latest Unstable Version](https://camo.githubusercontent.com/4d021436f257cebd01cdaa393b4ce7bc2a64772fc6ebc73dde51dfd9c84f754f/68747470733a2f2f706f7365722e707567782e6f72672f6179756269727a2f706572666563742d6d6f6e65792d6170692f762f756e737461626c65)](https://packagist.org/packages/ayubirz/perfect-money-api) [![License](https://camo.githubusercontent.com/455298e31d1d3f70e5c6b6f0b94642a7c69f798f867afc5e071d788b1cc4672f/68747470733a2f2f706f7365722e707567782e6f72672f6179756269727a2f706572666563742d6d6f6e65792d6170692f6c6963656e7365)](https://packagist.org/packages/ayubirz/perfect-money-api)

An easy to use PHP package to integrate PerfectMoney online payment API into your application. You can perform basic functions provided by [PerfectMoney](https://perfectmoney.is) payment gateway.

Just install the package and it is ready to use! There is no additional work requiered!

Requirements
============

[](#requirements)

- PHP &gt;= 7.0

Installation
============

[](#installation)

If you use composer as your dependency manager, you can download and install the package super easy by just running below command inside your project root directory:

```
$ composer require ayubirz/perfect-money-api:dev-master

```

Currently there is only dev-master available. Soon there will be stable releases to install and use.

Usage
=====

[](#usage)

After installing the package, you should first "use" the package's namespace inside your code where you want to use **PerfectMoneyAPI** methods. For example in your Controller you should type below code at the beggining of your file, right after the **namespace your/name/space;** line:

```
use AyubIRZ\PerfectMoneyAPI\PerfectMoneyAPI;

```

Then, you should initiate an instance of **PerfectMoneyAPI** class, wherever you needed it, as below:

```
$PMAccountID = '1234567';      // This should be replaced with your real PerfectMoney Member ID(username that you login with).

$PMPassPhrase = 'mydummypass'; // This should be replaced with your real PerfectMoney PassPhrase(password that you login with).

$PM = new PerfectMoneyAPI($PMAccountID, $PMPassPhrase);

```

After creating an instance of **PerfectMoneyAPI** class, you would be able to use available methods inside it.

**Getting an existing PerfectMoney account's public name**

```
$accountID = 'U123456'; // A valid PM currency account ID that you want to get it's name.

try{
  $PMname = $PM->getAccountName($accountID); // The account name(if it's valid) will return. Otherwise you have an error.
} catch (Exception $exception) {
  return $exception->getMessage();
}

return $PMname;

```

If any error happens, exceptions will be thrown. Check the code for more information about exceptios.

**Getting the complete balance(current amount of currencies) of your account**

```
$PMbalance = $PM->getBalance(); // array of all your currency wallets(as keys) and all of their balances(as values) will return.

return json_encode($PMbalance);

```

**Getting a specific wallet's balance(current amount of currency) of your account**

If you want to have only one specific wallet's balance in return, you should specify one of your wallet IDs as the only parameter to below method. For example, I want to get my USD wallet's balance:

```
$PMAccountID = 'U123456'; // Replace this with one of your wallet IDs.

$PMbalance = $PM->getBalance($PMAccountID); // A float number indicating your input wallet's balance will return(For example 250.05 USD in my case).

return json_encode($PMbalance);

```

**Transfer funds(currency, money) to another existing PerfectMoney account**

If you want to transfer amounts of money(currency) to any other PerfectMoney account, you can use below method with the specified parameters:

```
$fromAccount = 'U123456'; // Replace this with one of your own wallet IDs that you want to transfer currency from.

$toAccount = 'U654321'; // Replace this with the destination wallet ID that you want to transfer currency to.

$amount = 250; // Replace this with the amount of currency unit(in this case 250 USD) that you want to transfer.

$paymentID = microtime(); // Replace this with a unique payment ID that you've generated for this transaction. This can be the ID for the database stored record of this payment for example(Up to 50 characters). ***THIS PARAMETER IS OPTIONAL***

$memo = 250; // Replace this with a description text that will be shown for this transaction(Up to 100 characters). ***THIS PARAMETER IS OPTIONAL***

$PMtransfer = $pm->transferFund($fromAccount, $toAccount, $amount, $paymentID, $memo); // An array of previously provided data will return for a valid and successful transaction. If any error happen, an array with one item with the key "ERROR" will return.

return json_encode($PMtransfer);

```

**Creating new PerfectMoney E-Voucher**

***E-Voucher*** are like gift cards. An ***E-Voucher*** may has some amount of currency credit in it and it can be used to fund an account or etc. To create a new ***E-Voucher*** from one of your wallet's credit, you should use below method as followed:

```
$payerAccount = 'U123456'; // Replace this with one of your own wallet IDs that you want to create the E-Voucher from it.

$amount = 250; // Replace this with the amount of currency unit(in this case 250 USD) that you want to fund the created E-Voucher. E-Voucher amount unit must be greater than 1.

$PMeVoucher = $pm->createEV($payerAccount, $amount); // An array of E-Voucher data(Payer_Account, PAYMENT_AMOUNT, PAYMENT_BATCH_NUM, VOUCHER_NUM, VOUCHER_CODE, VOUCHER_AMOUNT) will return for a valid and successful transaction. If any error happen, an array with one item with the key "ERROR" will return.

return json_encode($PMeVoucher);

```

The returned array is as below:

- Payer\_Account: The account which you used to create the E-Voucher.
- PAYMENT\_AMOUNT: Numerical amount of E-Voucher as entered. This is the total amount you payed icluding fee.
- PAYMENT\_BATCH\_NUM: PerfectMoney batch number generated for this transaction. You may query/search account history by this number.
- VOUCHER\_NUM: Unique number of purchased E-Voucher contaning 10 digits.
- VOUCHER\_CODE: Activation code of purchased E-Voucher contaning 16 digits.
- VOUCHER\_AMOUNT: Nominal amount of E-Voucher. This is the same value as the amount input field.

Support
=======

[](#support)

If you have found a bug or you have a usage issue, please use the [GitHub issue tracker](https://github.com/AyubIRZ/PerfectMoneyAPI/issues).

Or email me at:

License
=======

[](#license)

This package is published under the MIT License (MIT). Please see [License File](https://github.com/AyubIRZ/PerfectMoneyAPI/blob/master/LICENSE) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.7% 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.

### Community

Maintainers

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

---

Top Contributors

[![AyubIRZ](https://avatars.githubusercontent.com/u/37051071?v=4)](https://github.com/AyubIRZ "AyubIRZ (11 commits)")[![Diakiss](https://avatars.githubusercontent.com/u/51768149?v=4)](https://github.com/Diakiss "Diakiss (1 commits)")

### Embed Badge

![Health badge](/badges/ayubirz-perfect-money-api/health.svg)

```
[![Health](https://phpackages.com/badges/ayubirz-perfect-money-api/health.svg)](https://phpackages.com/packages/ayubirz-perfect-money-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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