PHP code example of rikudou / pay-by-square-decoder

1. Go to this page and download the library: Download rikudou/pay-by-square-decoder 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/ */

    

rikudou / pay-by-square-decoder example snippets




use Rikudou\BySquare\Decoder\PayBySquareDecoder;

$encodedData = '0006Q0000UAT63HVES6GL5A5A0O9NSPEEHUHIEP70EG9LM6LU6EBNQ8KG6RB2N2LUIHMVTV51KQ77DGFC25KM2S9V46EQSN5GSD9J1N4BKT1L9ASVOOT1LPOMAO66IS2BHJDCNA4D9LFKG9MTFLISBD36O5CQQNJIBB2TJILQVVN684000';
$decoder = new PayBySquareDecoder();

$decodedData = $decoder->decode($encodedData);
// $decodedData is now an instance of \Rikudou\BySquare\VO\DecodedBySquareData



use Rikudou\BySquare\Decoder\PayBySquareDecoder;

$decoder = new PayBySquareDecoder();
$decoder->setXzBinary('/path/to/xz');

$decodedData = $decoder->decode($encodedData);
// $decodedData is now an instance of \Rikudou\BySquare\VO\DecodedBySquareData



use Rikudou\BySquare\Decoder\PayBySquareDecoder;
use Rikudou\BySquare\Config\PayBySquareDecoderConfiguration;

$config = new PayBySquareDecoderConfiguration();
$config
    ->setAllowPartialData(false);

$decoder = new PayBySquareDecoder($config);


use Rikudou\BySquare\Decoder\PayBySquareDecoder;

class MyService
{
    /**
     * @var PayBySquareDecoder
     */
    private $decoder;
    
    public function __construct(PayBySquareDecoder $decoder)
    {   
        $this->decoder = $decoder;
    }
}