PHP code example of cblink / pospal

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

    

cblink / pospal example snippets


$pospal = new \Hanson\Pospal\Pospal([
    'url' => 'your-url',
    'app_id' => 'your-app-id',
    'app_key' => 'your-app-key',
]);

$ticket = $pospal->ticket;

$result = $ticket->allPayMethod();

$result = $ticket->query($sn);

$result = $ticket->paginate([
   'startTime' => '2017-09-25 01:59:59',
   'endTime' => '2017-09-25 23:59:59',
]);

// 默认查询昨天
$result = $ticket->all([], function ($tickets) {
    foreach($tickets as $ticket) {
        echo $ticket['sn'];
    }
});