question

ismdcf avatar image
ismdcf asked ·

Customer Receipt Printing fails for orders made via API

We use the following code to invoke a payment receipt print job via the clover android sdk, as soon as we create an order via the clover api.
new AsyncTask<Void, Void, Printer>() {
    @Override
    protected Printer doInBackground(Void... params) {
        return getPrinter(Category.RECEIPT);
    }
    @Override
    protected void onPostExecute(Printer printer) {
        if (printer == null) {
            ContextHelper.displayToast("No Connected Receipt Printers Found,\nPlease Contact the Merchant for more info",
                    (Activity)thisActivity,Toast.LENGTH_LONG);
            return;
        }
        if (mOrder != null) {
            Log.d(TAG, "Printing Order Receipt");
            StaticReceiptPrintJob print_job = new StaticReceiptPrintJob.Builder().order(mOrder).build();
            print_job.print(thisActivity, account, printer);
        } else {
            Log.d(TAG, "Order is null");
        }
    }
}.execute();

The printing fails if the

is checked on the payment receipts setup
And the printing works as expected if we uncheck the above Cashier name checkbox.

We tested the above on a clover station 2018 as well as a clover mini both configured to the sandbox environment.
OrdersClover Android SDKPrintClover Station 2018
1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Also please note that we are not passing in an Employee with the Order object when placing an Order via the API. (since we cannot determine the Employee at this point).

Could this be the cause for the printing failure?

1 Like 1 ·

1 Answer

chanel avatar image
chanel answered ·
@ismdcf That is correct. Because you are not passing an Employee, it's trying to print the "null" object. You can either:

1) Default to the Employee that is the Owner (all merchants will have this) (requires Employee READ)
2) Create a specific Employee to denote "online orders" (requires Employee READ and WRITE)

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community