PHPackages                             daniel-spravtsev/yoomoney-sdk-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. daniel-spravtsev/yoomoney-sdk-php

ActiveLibrary[Payment Processing](/categories/payments)

daniel-spravtsev/yoomoney-sdk-php
=================================

Yoomoney API SDK for PHP (forked from yandex.money sdk)

v3.1.1(2y ago)1769↓50%MITPHPPHP &gt;=5.3.0

Since Mar 18Pushed 2y agoCompare

[ Source](https://github.com/DanielSpravtsev/yoomoney-sdk-php)[ Packagist](https://packagist.org/packages/daniel-spravtsev/yoomoney-sdk-php)[ RSS](/packages/daniel-spravtsev-yoomoney-sdk-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (14)Used By (0)

\[UNOFFICIAL\] PHP Yoomoney SDK PHP [forked from Yandex.Money SDK PHP](https://github.com/romkavt/yandex-money-sdk-php)
=======================================================================================================================

[](#unofficial-php-yoomoney-sdk-php-forked-from-yandexmoney-sdk-php)

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

[](#requirements)

PHP 5.3 or above

Links
-----

[](#links)

1. Yoomoney API page: [Ru](http://yoomoney.ru), [En](http://yoomoney.ru)
2. [sample app](https://github.com/yandex-money/yandex-money-sdk-php-sample)

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

1. Add `"daniel-spravtsev/yoomoney-sdk-php": "3.0.*"` to `composer.json` of your application. Or clone repo to your project.
2. If you are using composer - simply use `require_once 'vendor/autoload.php';` otherwise paste following code ```
    // For payments from the Yoomoney wallet
    require_once '/path/to/cloned/repo/lib/api.php';

    // For payments from bank cards without authorization
    require_once '/path/to/cloned/repo/lib/external_payment.php';
    ```

### Payments from the Yoomoney wallet

[](#payments-from-the-yoomoney-wallet)

Using Yoomoney API requires following steps

1. Obtain token URL and redirect user's browser to Yandex.Money service. Note: `client_id`, `redirect_uri`, `client_secret` are constants that you get, when [register](https://yoomoney/myservices/new.xml) app in Yandex.Money API.

    ```
    use \YandexMoney\API;

    $auth_url = API::buildObtainTokenUrl($client_id, $redirect_uri, $scope);
    ```
2. After that, user fills Yandex.Money HTML form and user is redirected back to `REDIRECT_URI?code=CODE`.
3. You should immediately exchange `CODE` with `ACCESS_TOKEN`.

    ```
    $access_token_response = API::getAccessToken($client_id, $code, $redirect_uri, $client_secret=NULL);
    if(property_exists($access_token_response, "error")) {
        // process error
    }
    $access_token = $access_token_response->access_token;
    ```
4. Now you can use Yandex.Money API.

    ```
    $api = new API($access_token);

    // get account info
    $acount_info = $api->accountInfo();

    // check status

    // get operation history with last 3 records
    $operation_history = $api->operationHistory(array("records"=>3));

    // check status

    // make request payment
    $request_payment = $api->requestPayment(array(
        "pattern_id" => "p2p",
        "to" => $money_wallet,
        "amount_due" => $amount_due,
        "comment" => $comment,
        "message" => $message,
        "label" => $label,
    ));

    // check status

    // call process payment to finish payment
    $process_payment = $api->processPayment(array(
        "request_id" => $request_payment->request_id,
    ));
    ```

### Payments from bank cards without authorization

[](#payments-from-bank-cards-without-authorization)

1. Fetch instantce-id(ussually only once for every client. You can store result in DB).

    ```
    use \YandexMoney\ExternalPayment;

    $response = ExternalPayment::getInstanceId($client_id);
    if($response->status == "success") {
        $instance_id = $response->instance_id;
    }
    else {
        // throw exception with $response->error message
    }
    ```
2. Make request payment

    ```
    // make instance
    $external_payment = ExternalPayment($instance_id);

    $payment_options = array(
        // pattern_id, etc..
    );
    $response = $external_payment->request($payment_options);
    if($response->status == "success") {
        $request_id = $response->request_id;
    }
    else {
        // throw exception with $response->message
    }
    ```
3. Process the request with process-payment.

    ```
    $process_options = array(
        "request_id" => $request_id
        // other params..
    );
    $result = $external_payment->process($process_options);
    // process $result according to docs
    ```

Side notes
----------

[](#side-notes)

1. Library throws exceptions in case of
    - response status isn't equal 2\*\*
    - I/O error(see [requests](https://github.com/rmccue/Requests))
2. If you register app and fill `CLIENT_SECRET` entry then you should provide `$client_secret` explicitly where `$client_secret=NULL`
3. You should wrap all passed boolean values in quotes(because php converts them to numbers otherwise). For example:

```
API($access_token).requestPayment(array(
    test_payment => "true",
    // other params
));
```

Running tests
-------------

[](#running-tests)

1. Clone this repo.
2. Install composer
3. Run `composer install`
4. Make sure `phpunit` executable is present in your `$PATH`
5. Create `tests/constants.php` with `CLIENT_ID`, `CLIENT_SECRET` and `ACCESS_TOKEN`constants.
6. Run tests `phpunit --bootstrap vendor/autoload.php tests/`

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 58.4% 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 ~301 days

Recently: every ~843 days

Total

13

Last Release

825d ago

Major Versions

v1.3.0 → v3.0.02014-09-24

### Community

Maintainers

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

---

Top Contributors

[![melnikovdv](https://avatars.githubusercontent.com/u/1157437?v=4)](https://github.com/melnikovdv "melnikovdv (122 commits)")[![raymank26](https://avatars.githubusercontent.com/u/8013845?v=4)](https://github.com/raymank26 "raymank26 (41 commits)")[![z-aliakseyeu](https://avatars.githubusercontent.com/u/742288?v=4)](https://github.com/z-aliakseyeu "z-aliakseyeu (19 commits)")[![kugaevsky](https://avatars.githubusercontent.com/u/125203?v=4)](https://github.com/kugaevsky "kugaevsky (7 commits)")[![baibaratsky](https://avatars.githubusercontent.com/u/1774061?v=4)](https://github.com/baibaratsky "baibaratsky (6 commits)")[![DanielSpravtsev](https://avatars.githubusercontent.com/u/31937522?v=4)](https://github.com/DanielSpravtsev "DanielSpravtsev (5 commits)")[![paction](https://avatars.githubusercontent.com/u/494904?v=4)](https://github.com/paction "paction (2 commits)")[![lennytmp](https://avatars.githubusercontent.com/u/1597230?v=4)](https://github.com/lennytmp "lennytmp (2 commits)")[![a-t](https://avatars.githubusercontent.com/u/7299277?v=4)](https://github.com/a-t "a-t (1 commits)")[![mesilov](https://avatars.githubusercontent.com/u/1843965?v=4)](https://github.com/mesilov "mesilov (1 commits)")[![romkavt](https://avatars.githubusercontent.com/u/5063381?v=4)](https://github.com/romkavt "romkavt (1 commits)")[![tevtushok](https://avatars.githubusercontent.com/u/2205708?v=4)](https://github.com/tevtushok "tevtushok (1 commits)")[![Grey2k](https://avatars.githubusercontent.com/u/332706?v=4)](https://github.com/Grey2k "Grey2k (1 commits)")

---

Tags

phpmoneysdkpaymentyoomoney

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/daniel-spravtsev-yoomoney-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/daniel-spravtsev-yoomoney-sdk-php/health.svg)](https://phpackages.com/packages/daniel-spravtsev-yoomoney-sdk-php)
```

###  Alternatives

[yandex-money/yandex-money-sdk-php

Yandex.Money API SDK for PHP

105167.4k2](/packages/yandex-money-yandex-money-sdk-php)[cryptonator/merchant-php-sdk

Cryptonator.com Merchant API SDK for PHP

2713.7k](/packages/cryptonator-merchant-php-sdk)

PHPackages © 2026

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