vmalits / bpay-sdk
Modern PHP SDK for BPay.md payment gateway
1.0.0
2026-01-06 15:47 UTC
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0
This package is not auto-updated.
Last update: 2026-04-01 15:41:53 UTC
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