Easy link cloud thermal ticket printer (K4-WH) access guide

Yilianyun thermal ticket printer provides rich interfaces and convenient open platform. Here, the access process of K4-WH model (WIFI version) is summarized.

K4-WH (WA) access WIFI method


Yilian cloud printing development document


Concepts and terminology

weather phenomenon

Self owned application service mode: if you are an individual / individual merchant / enterprise and develop the cloud printer managed by yourself, the created application is the self owned application service mode and can only be authorized to the developer's own account.

Open application service mode: after an enterprise completes the design and development of an application independently, it is promoted to merchants as a commodity service, and multiple merchants can be authorized. Merchants need to be authorized through the authorization code mode of Oauth2.0.

client_id: the ID of the application, a globally unique string, and the unique ID of the application, which is allocated when creating the application

client_secret: the private key of the application, which is generally matched with the client of the application_ IDs are used in pairs to verify the legitimacy of the application.

Verb interpretation

Authorization: if an application developed by a developer wants to access the merchant's information, it must be approved by the merchant. The operation of whether the merchant agrees to access initiated by the application is called authorization.

Push: the open platform sends "order confirmation", "print status change", "printer status change" and other messages to the application, which is called push message to the application.

Callback: after the merchant agrees or rejects the authorization request of the application, the open platform opens the callback URL set by the application and attaches the operation information agreed or rejected by the merchant, which is called the open platform callback application.

Access API

Generally, the "own application service mode" is used to manage their own wireless printers. Using client_id, client_secret get access_token (access token).

"Own application service mode" to obtain access_token (access token) and terminal authorization method( link).

Access Token acquisition or refresh frequency limit for each Client Id: 20 times / day
In this mode, the Access Token has no expiration time and is well stored to avoid the frequency exceeding the limit caused by multiple acquisitions!!!



For SDK usage, please refer to the on Github warehouse homepage Usage.

The SDK comes with the encapsulation of interfaces such as text printing and graphic printing, which can be called directly according to the Usage.

If you want to call interfaces such as voice adjustment and order confirmation, you need to pass in appropriate parameters:

$ylyRpcClient = new YlyRpcClient($access_token, $config);
// This interface returns success, but the machine does not respond
$ylyRpcRes = $ylyRpcClient->call('printer/shutdownrestart',  array('machine_code' => $machine_code, 'response_type' => 'shutdown'));

$ylyRpcRes = $ylyRpcClient->call('printer/setsound',  array('machine_code' => $machine_code, 'response_type' => 'buzzer', 'voice' => 3));
// horn has female voice, indicating "setting succeeded"
$ylyRpcRes = $ylyRpcClient->call('printer/setsound',  array('machine_code' => $machine_code, 'response_type' => 'horn', 'voice' => 3));

// printer/printinfo returns the result
// object(stdClass)#19 (3) {
//     ["error"]=>
//     string(1) "0"
//     ["error_description"]=>
//     string(7) "success"
//     ["body"]=>
//     object(stdClass)#20 (2) {
//       ["version"]=>
//       string(2) "k4"
//       ["print_width"]=>
//       string(4) "58mm"
//     }
//   }
$ylyRpcRes = $ylyRpcClient->call('printer/printinfo',  array('machine_code' => $machine_code));

// printer/getversion error: this interface is obsolete!
$ylyRpcRes = $ylyRpcClient->call('printer/getversion',  array('machine_code' => $machine_code));

// $ylyRpcRes = $ylyRpcClient->call('printer/getorder',  array('machine_code' => $machine_code, 'response_type' => 'close'));

$ylyRpcRes = $ylyRpcClient->call('print/index', array('machine_code' => $machine_code, 'content' => '<FS><center>The miracle came out</center></FS>', 'origin_id' => mt_rand(100000, 999999)));

Posted on Mon, 08 Nov 2021 15:54:20 -0500 by dabigchz