Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.
/ qiwi-topup Public archive

Top-Up API is intended for merchants or payment service providers (PSP) who need to send money to QIWI Wallet users.

Notifications You must be signed in to change notification settings

antonowano/qiwi-topup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example

Install

composer require antonowano/qiwi-topup

Get balance

use Antonowano\QiwiTopup\Constant\ErrorCodes;
use Antonowano\QiwiTopup\Factory\RequestFactory;
use Antonowano\QiwiTopup\QiwiTopup;

$qiwi = new QiwiTopup();
$requestFactory = new RequestFactory(123, 'password');
$request = $requestFactory->createForGetBalance();
$response = $qiwi->sendRequest($request);

if ($response->getResultCode() == ErrorCodes::NO_ERROR) {
    var_dump($response->getBalances());
}

Pay to card

use Antonowano\QiwiTopup\Constant\Currencies;
use Antonowano\QiwiTopup\Constant\PaymentStatuses;
use Antonowano\QiwiTopup\Factory\RequestFactory;
use Antonowano\QiwiTopup\QiwiTopup;

$qiwi = new QiwiTopup();
$requestFactory = new RequestFactory(123, 'password');
$request = $requestFactory->createForPayToCard();
$request
    ->setTransactionNumber(12345678)
    ->setFromCcy(Currencies::RUB)
    ->setToAmount(1115)
    ->setToCcy(Currencies::RUB)
    ->setToAccountNumber('4265111122334411')
;
$response = $qiwi->sendRequest($request);
$payment = $response->getPayment();

if ($payment->getStatus() == PaymentStatuses::EXECUTED) {
    echo $payment->getTransactionNumber();
}

Pay to QIWI

use Antonowano\QiwiTopup\Constant\Currencies;
use Antonowano\QiwiTopup\Constant\PaymentStatuses;
use Antonowano\QiwiTopup\Factory\RequestFactory;
use Antonowano\QiwiTopup\QiwiTopup;

$qiwi = new QiwiTopup();
$requestFactory = new RequestFactory(123, 'password');
$request = $requestFactory->createForPayToQiwi();
$request
    ->setIncomeWireTransfer(1)
    ->setToAmount(15)
    ->setToCcy(Currencies::RUB)
    ->setFromCcy(Currencies::USD)
    ->setTransactionNumber(321456)
    ->setToAccountNumber('79181234567')
;
$response = $qiwi->sendRequest($request);
$payment = $response->getPayment();

if ($payment->getStatus() == PaymentStatuses::EXECUTED) {
    echo $payment->getTransactionNumber();
}

Get status

use Antonowano\QiwiTopup\Constant\PaymentStatuses;
use Antonowano\QiwiTopup\Factory\RequestFactory;
use Antonowano\QiwiTopup\QiwiTopup;

$qiwi = new QiwiTopup();
$requestFactory = new RequestFactory(123, 'password');
$request = $requestFactory->createForGetStatus();
$request
    ->setTransactionNumber(12345678)
    ->setToAccountNumber('79181234567')
;
$response = $qiwi->sendRequest($request);
$payment = $response->getPayment();

if ($payment->getStatus() == PaymentStatuses::EXECUTED) {
    echo $payment->getTransactionNumber();
}

Check deposit possible

use Antonowano\QiwiTopup\Factory\RequestFactory;
use Antonowano\QiwiTopup\QiwiTopup;

$qiwi = new QiwiTopup();
$requestFactory = new RequestFactory(123, 'password');
$request = $requestFactory->createForCheckDepositPossible();
$request
    ->setPhone('79031234567')
    ->setIncomeWireTransfer(1)
;
$response = $qiwi->sendRequest($request);
$exist = $response->getExist();
$possible = $response->getDepositPossible();

About

Top-Up API is intended for merchants or payment service providers (PSP) who need to send money to QIWI Wallet users.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages