承接 baibaratsky/php-webmoney 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

baibaratsky/php-webmoney

Composer 安装命令:

composer require baibaratsky/php-webmoney

包简介

WebMoney API PHP Library

README 文档

README

Packagist Dependency Status Packagist Packagist

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

Requirements

The library requires PHP 5.3 compiled with cURL extension (but you can override cURL dependencies).

Installation

  1. Install Composer:

    curl -sS https://getcomposer.org/installer | php
    
  2. Add the php-webmoney dependency:

    php composer.phar require baibaratsky/php-webmoney:0.18.*
    

Usage

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\Api\X\X9\Request;
use baibaratsky\WebMoney\Api\X\X9\Response;
use baibaratsky\WebMoney\Request\Requester\CurlRequester;
use baibaratsky\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\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 baibaratsky\WebMoney;
use baibaratsky\WebMoney\Api\X\X9\Request;
use baibaratsky\WebMoney\Api\X\X9\Response;
use baibaratsky\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\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();
    }
}

baibaratsky/php-webmoney 适用场景与选型建议

baibaratsky/php-webmoney 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 374.05k 次下载、GitHub Stars 达 74, 最近一次更新时间为 2013 年 12 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「webmoney」 「megastock」 「capitaller」 「wmsigner」 「WMXI」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 baibaratsky/php-webmoney 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 baibaratsky/php-webmoney 我们能提供哪些服务?
定制开发 / 二次开发

基于 baibaratsky/php-webmoney 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 374.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 75
  • 点击次数: 13
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 74
  • Watchers: 10
  • Forks: 29
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-12-06