kostikpenzin/alfabank-api-acquiring

Api client for Alfabank acquiring

1.0.7 2023-12-16 21:49 UTC

This package is auto-updated.

Last update: 2024-12-17 00:10:36 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads

API connection with the payment page on the bank's side.

Installation

$ composer require kostikpenzin/alfabank-api-acquiring

Example

<?php

include 'vendor/autoload.php';

$client = new \kostikpenzin\AlfabankApiAcquiring\Client([
    'baseUrl' => 'https://alfa.rbsuat.com',
    'token' => "token", // or token
    'userName' => "name", // or userName and password
    'password' => "password"
]);

$orderId = "test" . rand();

// create order for pay
// https://alfabank.ru/sme/payservice/internet-acquiring/docs/connection-options/api/rest/#zapros_registratsii_zakaza
$response = $client->register([
            'orderNumber' => $orderId,
            'amount' => 10000,
            'returnUrl' => "https://returnUrl",
            'failUrl' => "https://failUrl",
            'description' => "description order",
            'language' => "ru",
            'clientId' => rand(),
            'email' => "penzin85@gmail.com",
]);

print_r($response);
/* response:
{
    "orderId":"70906e55-7114-41d6-8332-4609dc6590f4",
    "formUrl":"https://alfa.rbsuat.com/payment/merchants/test/payment_ru.html?mdOrder=70906e55-7114-41d6-8332-4609dc6590f4"
}
*/



// check status order
// https://alfabank.ru/sme/payservice/internet-acquiring/docs/connection-options/api/rest/#zapros_sostojanija_zakaza
$response = $client->getOrderStatus([
    'orderId' => $orderId
]);
print_r($response);
/* response:
{
    "expiration":"201512",
    "cardholderName":"tr tr",
    "depositAmount": 789789,
    "currency":"810",
    "approvalCode":"123456",
    "authCode": 2,
    "clientId":"666",
    "bindingId":"07a90a5d-cc60-4d1b-a9e6-ffd15974a74f",
    "ErrorCode":"0",
    "ErrorMessage":"Успешно",
    "OrderStatus": 2,
    "OrderNumber":"23asdafaf",
    Pan":"411111**1111",
    "Amount": 789789
}
*/

Test cards for check integration

https://pay.alfabank.ru/ecommerce/faq/index.html