PHP code example of business-ru / atol-api-sdk-php

1. Go to this page and download the library: Download business-ru/atol-api-sdk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

business-ru / atol-api-sdk-php example snippets



# Подключаем автозагрузку
Client
iClient = new AtolClient($this->account, $this->userLogin, $this->integrationPassword);


$params = [
    "timestamp" => date("d.m.Y H:i:s"),
    "external_id" => uniqid('', true),
    "receipt" => [
        "client" => [
            "email" => "[email protected]"
        ],
        "sno" => "osn",
        "items" => [
            [
                "name" => "Чек Прихода №1",
                "price" => 1,
                "quantity" => 1,
                "sum" => 1,
                "measurement_unit" => "гр.",
                "payment_method" => "full_prepayment",
                "payment_object" => "payment",
                "vat" => [
                    "type" => "vat20",
                ]
            ]
        ],
        "payments" => [
            [
                "type" => 1,
                "sum" => 1
            ]
        ],
        "total" => 1
    ]
];
$sell = $atolApiClient->sell($params);


$params = [
    "timestamp" => date("d.m.Y H:i:s"),
    "external_id" => uniqid('', true),
    "receipt" => [
        "client" => [
            "email" => "[email protected]"
        ],
        "sno" => "osn",
        "items" => [
            [
                "name" => "Чек Прихода №1",
                "price" => 1,
                "quantity" => 1,
                "sum" => 1,
                "measurement_unit" => "гр.",
                "payment_method" => "full_prepayment",
                "payment_object" => "payment",
                "vat" => [
                    "type" => "vat20",
                ]
            ]
        ],
        "payments" => [
            [
                "type" => 1,
                "sum" => 1
            ]
        ],
        "total" => 1
    ]
];
$sellRefund = $atolApiClient->sellRefund($params);


$uuID = $sellRefund["uuid"];
$atolApiClient->report($uuID);