PHP code example of mitalcoi / php-webmoney

1. Go to this page and download the library: Download mitalcoi/php-webmoney library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mitalcoi / php-webmoney example snippets




use baibaratsky\WebMoney;
use baibaratsky\WebMoney\Signer;

$webMoney = new WebMoney\WebMoney(new WebMoney\Request\Requester\CurlRequester);

$request = new WebMoney\Api\X\X9\Request;
$request->setSignerWmid('YOUR WMID');
$request->setRequestedWmid('REQUESTED WMID');

$request->sign(new Signer('YOUR WMID', 'FULL PATH TO KEY FILE', 'KEY FILE PASSWORD'));

if ($request->validate()) {
    /** @var WebMoney\Api\X\X9\Response $response */
    $response = $webMoney->request($request);

    if ($response->getReturnCode() === 0) {
        echo $response->getPurseByName('Z000000000000')->getAmount();
    }
}

    curl -sS https://getcomposer.org/installer | php
    

    php composer.phar