grandmasterx/webmoney
Composer 安装命令:
composer require grandmasterx/webmoney
包简介
WebMoney API PHP Library
README 文档
README
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.
XML-interfaces supported
- X1: sending invoice from merchant to customer
- X2: transferring funds from one purse to another
- X3: transactions history, checking transactions status
- X4: issued invoices history, verifying whether the invoices were paid
- X5: completing a code-protected transaction
- 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
- X13: recalling incomplete protected transaction
- X14: fee-free refund
- X15: trust management
- X17: operations with arbitration contracts
- X18: getting transaction details via merchant.webmoney
- X19: verifying personal information for the owner of a WM identifier
- X21: setting trust for merchant payments by SMS
- X22: receiving the ticket of prerequest payment form at merchant.webmoney
- X23: rejection of received invoices or cancellation of issued invoices
XML-interfaces to top-up WMZ and WME
- ATM1: preliminary request on the payment possibility
- ATM2: payment request
- WMC1: preliminary request on the payment possibility (WebMoney.Check)
- WMC2: payment request (WebMoney.Check)
- WMC3: payments log (WebMoney.Check)
Megastock interfaces supported
- Interface for adding Payment Integrator's merchants
- Interface for check status of merchant
Requirements
The library requires PHP 5.3 compiled with cURL extension (but you can override cURL dependencies).
Installation
-
Install Composer:
curl -sS https://getcomposer.org/installer | php -
Add the php-webmoney dependency:
php composer.phar require grandmasterx/webmoney:0.16.*
Usage
There are more usage examples in the project wiki.
require_once(__DIR__ . '/vendor/autoload.php'); // Require autoload file generated by composer use grandmasterx\WebMoney; use grandmasterx\WebMoney\Api\X\X9\Request; use grandmasterx\WebMoney\Api\X\X9\Response; use grandmasterx\WebMoney\Request\Requester\CurlRequester; use grandmasterx\WebMoney\Signer; // If you don’t want to use the WM root certificate to protect against DNS spoofing, pass false to the CurlRequester constructor $webMoney = new WebMoney(new CurlRequester); $request = new Request; $request->setSignerWmid('YOUR WMID'); $request->setRequestedWmid('REQUESTED WMID'); $key = 'FULL PATH TO THE KEY FILE'; // or key is a data string from DB, cache, etc. // $key = getKeyData(); $request->sign(new Signer('YOUR WMID', $key, 'KEY FILE PASSWORD')); // You can access the request XML: $request->getData() if ($request->validate()) { /** @var Response $response */ $response = $webMoney->request($request); // The response from WebMoney is here: $response->getRawData() if ($response->getReturnCode() === 0) { echo $response->getPurseByName('Z000000000000')->getAmount(); } else { echo 'Error: ' . $response->getReturnDescription(); } }
Authentication with a Light certificate
In case of authentication with a Light certificate, pass Request::AUTH_LIGHT to the request constructor
and use lightAuth() instead of sign().
require_once(__DIR__ . '/vendor/autoload.php'); // Require autoload file generated by composer use grandmasterx\WebMoney; use grandmasterx\WebMoney\Api\X\X9\Request; use grandmasterx\WebMoney\Api\X\X9\Response; use grandmasterx\WebMoney\Request\Requester\CurlRequester; // If you don’t want to use the WM root certificate to protect against DNS spoofing, pass false to the CurlRequester constructor $webMoney = new WebMoney(new CurlRequester); $request = new Request(Request::AUTH_LIGHT); $request->setRequestedWmid('REQUESTED WMID'); $request->lightAuth('FULL PATH TO THE CERTIFICATE FILE', 'FULL PATH TO THE CERTIFICATE KEY', '(OPTIONAL) PASSWORD'); // You can access the request XML: $request->getData() if ($request->validate()) { /** @var Response $response */ $response = $webMoney->request($request); // The response from WebMoney is here: $response->getRawData() if ($response->getReturnCode() === 0) { echo $response->getPurseByName('Z000000000000')->getAmount(); } else { echo 'Error: ' . $response->getReturnDescription(); } }
grandmasterx/webmoney 适用场景与选型建议
grandmasterx/webmoney 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 399 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「webmoney」 「megastock」 「capitaller」 「wmsigner」 「WMXI」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 grandmasterx/webmoney 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 grandmasterx/webmoney 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 grandmasterx/webmoney 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WebMoney API PHP Library
WebMoney driver for the Omnipay payment processing library
PHP Client for Genesis Payment Processing Gateway
WebMoney driver for the Omnipay payment processing library
Yii2 webmoney extension
WebMoney XML API on PHP
统计信息
- 总下载量: 399
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-08-23