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+
jsonextensionguzzlehttp/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 exceptionApiException— API errorNetworkException— network errorInvalidSignatureException— invalid signatureValidationException— validation error
Enum / Value Objects
Currencyenum — MDL, RUB, USD, RON, EURLanguageenum — RU, RO, ENPaymentMethodenum — BPAY, CARD_OMD, CARD_EUR, CARD_USD, WEBMONEY_WMZ, WEBMONEY_WMRAmountVO — safe representation of amountUuidVO — payment identifierCurrencyVO — numeric currency codeParamsVO — 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
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-06