PHP code example of gamebay / rksv

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

    

gamebay / rksv example snippets


$receiptData = ReceiptData::withData(
    $receipt->cashBoxId->id, // Cash register ID
    $receipt->cashBoxId->daily_income, // Daily register income sum
    $receipt->number, // Receipt number
    \DateTime::createFromFormat('Y-m-d H:i:s', $receipt->created_at),
    [
        [
            'brutto' => 123,
            'tax' => 20        
        ],
        [
            'brutto' => 224,
            'tax' => 20 
        ]
    ],
    $receipt->previous_receipt->signature
);


$primeSignBaseCertificateURL = 'Insert Prime Sign base certificate URL';
$primeSignReceiptSignURL = 'Insert Prime Sign receipt sign URL';
$primeSignTokenKey = 'Insert Prime Sign token key';
$encryptionKey = 'Insert Prime Sign encryption key';
$primeSignCertificateNumber = 'Insert Prime Sign certificate number';
$taxRates = ['20', '10', '13', '0', 'special'];
$locationId = 'Insert location ID';

$receiptSigner = new ReceiptSigner(
    $primeSignBaseCertificateURL,
    $primeSignReceiptSignURL,
    $primeSignTokenKey,
    $primeSignCertificateNumber,
    $encryptionKey,
    $taxRates,
    $locationId,
    $receiptData
);

if ($this->gross > 0) {
    $receiptSigner->normalSign();
}

$signature = $receiptSigner->getSignature();
$QR = $receiptSigner->getQR();

$receiptSigner->nullSign();