Get transparent object-oriented interaction with WebMoney API.
If you just need to sign your requests to the API, use WebMoney Signer, a native PHP implementation of the WMSigner authentication module.
- X2: transferring funds from one purse to another
- X3: receiving transaction history, checking transaction status
- X6: sending message to any WM-identifier via internal mail
- X8: retrieving information about purse ownership, searching for system user by his/her identifier or purse
- X9: retrieving information about purse balance
- X11: retrieving information from client’s passport by WM-identifier
- X14: fee-free refund
- X17: operations with arbitration contracts
- X18: getting transaction details via merchant.webmoney
- X19: verifying personal information for the owner of a WM identifier
- Interface for adding Payment Integrator's merchants
- Interface for check status of merchant
The library requires PHP 5.3 compiled with cURL extension (but you can override cURL dependencies).
-
Install Composer:
curl -sS https://getcomposer.org/installer | php
-
Add the php-webmoney dependency:
php composer.phar require baibaratsky/php-webmoney:0.10.*
There are more usage examples in the project wiki.
require_once(__DIR__ . '/vendor/autoload.php'); // Require autoload file generated by composer
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();
}
}