vovamaliti/bpaypaymentapi

bpay api

安装: 420

依赖: 0

建议者: 0

安全: 0

星星: 2

观察者: 1

分支: 0

公开问题: 0

类型:

1.0 2018-06-18 08:44 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:21:14 UTC


README

该库允许您:从在线商店网站进行支付账单,接收并自动处理支付通知(CALLBACK),从您的bpay.md账户进行支付,请求交易信息,账户报表。

安装

使用以下命令安装最新版本:

$ composer require bpay/bpay-md-payment-api

基本用法

<?php
use Bpay\Payment\Check\Check;
use Bpay\Payment\Payment;
use Bpay\Payment\PaymentHistory\PaymentHistory;
use Bpay\Payment\Transaction\Transaction;



//check
$check = new Check();
$check->setType('1.2');
$check->setMerchantId('merchantId');
$check->setAmount('0.1');
$check->setDescription('some description');
$check->setMethod('bpay');
$check->setOrderId('admin@admin.com');
$check->setSuccessUrl('http://yourdomain.com');
$check->setFailUrl('https://yourdomain.com');
$check->setCallbackUrl('http://yourdomain.com');
$check->setLang('ru');
$check->setAdvanced1('221B Baker Street');
$check->setAdvanced2('');
$check->setIsTest('1'); //0 - real payment, 1 - test payment
$data = $check->serialize();

$payment = new Payment();
$result = $payment->check('https://www.bpay.md/user-api/payment1', $data, 'h42kd20d');

//callback
$payment1 = new Payment();
$data = 'DQogICAgICAgIDxwYXltZW50Pg0K3r3r3rICAgICAgICAJPHR5cGU+MS490ZXN0Pg0KICAgICAgICA8L3BheW1lbnQ+
';

$key = '0cb795b89fd49c82a233r3t3t3t34d01c0ce76785d';
$result = $payment1->getCheckInfo($key,$data, 'g5g3g3fg6');

//transaction 

$transaction = new Transaction();
$transaction->setLogin('yourlogin');
$transaction->setPassword('yourpassword');
$transaction->setTransId('1111111'); //or
$transaction->setReceipt('21445124124214214');

$transactionData = $transaction->serialize();

$payment1 = new Payment();
$result = $payment1->getTransactionInfo('https://www.bpay.md/user-api/checkstate1', $transactionData);

//payment history
$paymentHistory  = new PaymentHistory();
$paymentHistory->setLogin('yourlogin');
$paymentHistory->setPassword('yourpassword');
$paymentHistory->setAccount('1111111');
$paymentHistory->setDateStart('2018-06-12 ');
$paymentHistory->setDateEnd('2018-06-15 ');
$paymentHistory->setState('30');
$paymentHistory->setService('');
$paymentHistory->setDateType('');


$paymentHistoryResult = $paymentHistory->serialize();
$payment3 = new Payment();
$result  = $payment3->getPaymentHistory('https://www.bpay.md/user-api/getpaymentshistory',$paymentHistoryResult);

//transfer
$transfer = new \Bpay\Payment\Transfer\Transfer();
$transfer->setLogin('');
$transfer->setPassword('admin@admin.com');
$transfer->setTime();
$transfer->setPayerAccount('123425916');
$transfer->setAccount('2343451241');
$transfer->setAmount('1');
$transfer->setDescription('test payment');
$transfer->setTxnId(rand(1,1000));
$transfer->setTest('1');
$transfer->setSign('');

$transfer->serialize();

$paymentTransfer = new  Payment();
$paymentTransfer->transfer('https://www.bpay.md/user-api/transfer',$transfer,'key');

第三方包

Guzzle, PHP HTTP客户端Array2XML转换库

关于

要求

  • bpay/bpay-md-payment-api 与 PHP 5.6 及以上版本兼容

作者

Petrovschii Vladimir - petrovschii.vladimir@gmail.com VR Dev Team - tv@vr-dev.team

许可

bpay/bpay-md-payment-api 采用 MIT 许可证授权