jackmartin/popolniclub

Library PopolniClub API

1.6 2020-10-07 13:51 UTC

This package is auto-updated.

Last update: 2024-11-07 22:44:41 UTC


README

header

Описание

Latest Stable Version Total Downloads License

PHP библиотека для работы с API PopolniClub

Read this in other language: English, Русский, Український

Wiki - Описание работы библиотеки

Тестирование

Документация

API documentation

Требования

  • PHP 5.6 или выше
  • Composer

Composer

composer require jackmartin/popolniclub

Библиотеки

Guzzle

Основные методы API

  1. Создать платёж
  2. Статус платежа
  3. Текущий баланс

Примеры

__construct()

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');
// $pophone = new Pophone();
// $pophone
//     ->setLogin()
//     ->setPassword()
//     ->setAPI()
//     ->setSandbox();

sandbox()

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API', true);

sendPayment() - Пример 1

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

print_r(

    $pophone->sendPayment(

        [

            'transactionId' => 1000000001,
            'amount'        => 100,
            'msisdn'        => '380000000000',
            'templateID'    => 0

        ]

    )

);

sendPayment() - Пример 2

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

print_r(

    $pophone
        ->setTransactionID()
        ->setSumm(1)
        ->setPhone('380000000000')
        ->setTemplateID()
        ->addPayment()
        ->sendPayment()

);

sendPayment() - Пример 3

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

foreach (

    [
        [
            'phone' => '380000000000',
            'summ'  => 1
        ],
        [
            'phone' => '380000000001',
            'summ'  => 1
        ]
    ] 
    as 
    $key => $item

) {

    $pophone
        ->setTransactionID()
        ->setPhone($item['phone'])
        ->setSumm($item['summ'])
        ->setTemplateID()
        ->addPayment();

}

print_r(

    $pophone->sendPayment()->getData()

);

statusPayment() - Пример 1

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

print_r(

    $pophone->statusPayment(

        [

            [

                'transactionId' => 1000000001,
                'status'        => 0,

            ],

        ]
    )

);

statusPayment() - Пример 2

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

print_r(

    $pophone
        ->addTransaction(1000000001)
        ->statusPayment()

);

statusPayment() - Пример 3

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

foreach (

        [

            1000000001,
            1000000002,

        ] as $id

    ) {

        $pophone->addTransaction($id);

}

print_r(

    $pophone->statusPayment()->getData()
    // $pophone->statusPayment()->getRaw()
    // $pophone->statusPayment()->transaction()
    // $pophone->statusPayment()->status()

);

currentBalance()

require_once 'vendor/autoload.php';

use PopolniClub\Pophone;

$pophone = new Pophone('Ваш логин', 'Ваш пароль API');

print_r(

    $pophone->currentBalance()->getData()
    // $pophone->currentBalance()->getRaw()
    // $pophone->currentBalance()->balance()
    // $pophone->currentBalance()->balance(true)
    // $pophone->currentBalance()->credit()

);