diff --git a/README.md b/README.md index a566ecf..9d655d0 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,71 @@ try { } ``` +### Mass payment (withdraw) integration using UnitPay API + +```php +api('massPayment', [ + 'sum' => $orderSum, + 'purse' => $purse, + 'login' => $login, + 'transactionId' => $transactionId, + 'paymentType' => $paymentType, + 'projectId' => $projectId, +]); + +// If need user redirect on Payment Gate +if (isset($response->result)) { + // success result + $statusResponse = $unitpay->api('massPaymentStatus', [ + 'login' => $login, + 'transactionId' => $transactionId + ]); + echo 'Mass payment status: ' . $statusResponse->result->status; +} elseif (isset($response->error->message)) { + $error = $response->error->message; + print 'Error: '.$error; +} +``` + ## Installation ### Install composer package diff --git a/UnitPay.php b/UnitPay.php index b9fddd9..3f970d3 100644 --- a/UnitPay.php +++ b/UnitPay.php @@ -76,10 +76,19 @@ public function getPrice() class UnitPay { private $supportedCurrencies = array('EUR','UAH', 'BYR', 'USD','RUB'); - private $supportedUnitpayMethods = array('initPayment', 'getPayment'); + private $supportedUnitpayMethods = array( + 'initPayment', + 'getPayment', + 'getCommissions', + 'massPayment', + 'massPaymentStatus', + ); private $requiredUnitpayMethodsParams = array( 'initPayment' => array('desc', 'account', 'sum'), - 'getPayment' => array('paymentId') + 'getPayment' => array('paymentId'), + 'getCommissions' => array('projectId', 'login'), + 'massPayment' => array('login', 'purse', 'transactionId', 'sum', 'paymentType'), + 'massPaymentStatus' => array('login', 'transactionId'), ); private $supportedPartnerMethods = array('check', 'pay', 'error'); private $supportedUnitpayIp = array( @@ -344,4 +353,4 @@ public function getErrorHandlerResponse($message) ) )); } -} \ No newline at end of file +}