PHP code example of payprocessing / atol-online

1. Go to this page and download the library: Download payprocessing/atol-online 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/ */

    

payprocessing / atol-online example snippets


$client = new Platron\Atol\clients\PostClient();

$tokenService = new Platron\Atol\services\GetTokenRequest('login', 'password');
$tokenResponse = new Platron\Atol\services\GetTokenResponse($client->sendRequest($tokenService));

$client = new Platron\Atol\clients\PostClient();
$receiptPosition = new Platron\Atol\data_objects\ReceiptPosition('Test product', 10.00, 2, Platron\Atol\data_objects\ReceiptPosition::TAX_VAT10);

$createDocumentService = (new Platron\Atol\services\CreateDocumentRequest('token'))
    ->addCustomerEmail('[email protected]')
    ->addCustomerPhone('79268750000')
    ->addGroupCode('groupCode')
    ->addInn('inn')
    ->addMerchantAddress('paymentAddress')
    ->addOperationType(Platron\Atol\services\CreateDocumentRequest::OPERATION_TYPE_BUY)
    ->addPaymentType(Platron\Atol\services\CreateDocumentRequest::PAYMENT_TYPE_ELECTRON)
    ->addSno(Platron\Atol\services\CreateDocumentRequest::SNO_ESN)
    ->addExternalId('externalId')
    ->addReceiptPosition($receiptPosition);
$createDocumentResponse = new Platron\Atol\services\CreateDocumentResponse($client->sendRequest($createDocumentService));

$client = new Platron\Atol\clients\PostClient();
$getStatusService = new Platron\Atol\services\GetStatusRequest('groupCode', 'uuid', 'token');
$getStatusResponse = new Platron\Atol\services\GetStatusResponse($client->sendRequest($getStatusService));