Git Product home page Git Product logo

yii2-novapay's Introduction

NovaPay API клиент для Yii2

API: see doc

Конфигурация модуля

'modules' => [
    'novapay' => [
        'class' => dicr\novapay\NovaPayModule::class,
        'merchantId' => 'ваш_merchant_id',
        // приватный ключ клиента указывается либо как путь к файлу (через file://, либо PEM-код)
        'clientKey' => 'file://' . __DIR__ . '/client.key'
    ]
];

Использование

use dicr\novapay\NovaPayModule;
use dicr\novapay\request\FramesInitRequest;
use dicr\novapay\request\FramesInitResponse;use dicr\novapay\request\GetStatusRequest;

/** @var NovaPayModule $novaPay получаем модуль */
$novaPay = Yii::$app->getModule('novapay');

// запрос на создание платежа
$request = $novaPay->createRequest([
    'class' => FramesInitRequest::class,
    'amount' => 55.55,
    'products' => [
        [
            'description' => 'Товар1',
            'price' => 11.11,
            'count' => 1
        ],
        [
            'description' => 'Товар2',
            'price' => 22.22,
            'count' => 2
        ]
    ],
    'delivery' => [
        'volumeWeight' => 0.01,
        'weight' => 0.1
    ]
]);

/** @var FramesInitResponse $ret отправляем запрос */
$ret = $request->send();

echo 'Адрес для переадресации: ' . $ret->url . "\n";

// запрос на проверку состояние платежной сессии
$request = $novaPay->createRequest([
    'class' => GetStatusRequest::class,
    'sessionId' => $ret->sessionId
]);

$status = $request->send();

echo 'Статус: ' . $status . "\n";

yii2-novapay's People

Contributors

dicrtarasov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.