unetway/atol

用于处理阿特洛在线的包

0.1.1 2024-03-07 16:39 UTC

This package is auto-updated.

Last update: 2024-09-07 18:14:29 UTC


README

该包允许向阿特洛在线发送收据并获取其状态 阿特洛在线

安装

$ composer require unetway/atol

使用

向阿特洛发送收据

use Unetway\Atol\Atol;

$atol = new Atol([
    'login' => '',
    'password' => '',
    'group_code' => '',
    'company_email' => '',
    'sno' => '',
    'inn' => '',
    'payment_address' => '',
    'is_test' => false,
    'callback_url' => '',
    'vat' => 'vat20',
]);

$name = 'Имя';
$email = 'email@user.com';
$price = 700;

return $atol->receipt($name, $price, $email);

参数

  • name - 客户名称
  • price - 价格
  • email - 客户邮箱

获取收据状态

use Unetway\Atol\Atol;

$atol = new Atol([
    'login' => '',
    'password' => '',
    'group_code' => '',
    'company_email' => '',
    'sno' => '',
    'inn' => '',
    'payment_address' => '',
    'is_test' => false,
    'callback_url' => '',
    'vat' => 'vat20',
]);
$uuid = '';

return $atol->report($uuid);

获取指定回调地址的响应示例

$request = file_get_contents('php://input');
$res = json_decode($request, true);
$uuid = $res['uuid'];

if ($res['status'] !== 'done') {
    
}