定制 vmalits/bpay-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vmalits/bpay-sdk

最新稳定版本:1.0.0

Composer 安装命令:

composer require vmalits/bpay-sdk

包简介

Modern PHP SDK for BPay.md payment gateway

README 文档

README

Requirements

  • PHP 8.2+
  • json extension
  • guzzlehttp/guzzle ^7.8 (installed automatically via Composer)

Installation

Via Composer:

composer require vmalits/bpay-sdk

Quick start

use Malits\BPay\BpayClient;
use Malits\BPay\Builder\InvoiceBuilder;
use Malits\BPay\Enums\Currency;
use Malits\BPay\Enums\Language;
use Malits\BPay\Enums\PaymentMethod;

$client = new BpayClient('merchant_id', 'secret_key');

$invoice = InvoiceBuilder::create()
    ->uuid('your-uuid')
    ->merchantId('merchant_id')
    ->amount(100.0)
    ->orderId('order123')
    ->description('Order payment')
    ->successUrl('https://your-site/success')
    ->failUrl('https://your-site/fail')
    ->callbackUrl('https://your-site/callback')
    ->currency(Currency::MDL)
    ->language(Language::EN)
    ->paymentMethod(PaymentMethod::BPAY)
    ->addParam('customer_name', 'John')
    ->addParam('phone_number', '123456789')
    ->build();

$response = $client->createInvoice($invoice);
// $response->url — payment link

Payment check

$result = $client->checkPayment('uuid-payment');
if ($result->isPaid) {
    // Payment successful
}

Callback handling

$callbackDto = $client->handleCallback($_POST);

$uuid = $callbackDto->uuid->value;
$amount = $callbackDto->amount->value;
$currencyCode = $callbackDto->currency->code;

Exceptions

  • BPayException — base exception
  • ApiException — API error
  • NetworkException — network error
  • InvalidSignatureException — invalid signature
  • ValidationException — validation error

Enum / Value Objects

  • Currency enum — MDL, RUB, USD, RON, EUR
  • Language enum — RU, RO, EN
  • PaymentMethod enum — BPAY, CARD_OMD, CARD_EUR, CARD_USD, WEBMONEY_WMZ, WEBMONEY_WMR
  • Amount VO — safe representation of amount
  • Uuid VO — payment identifier
  • Currency VO — numeric currency code
  • Params VO — extra callback parameters

Tests

composer test

Examples

See EXAMPLES.md for detailed usage examples of all SDK features.

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-06