Jump to content

QR code on the receipt not sow


Recommended Posts

Posted

According to jordanian goverment its manditory to print a QR code on each receipt that printer to show the TAX Number and TaX Value , 

we finished all the aspect regarding this entegration but the Qr code cant pass to Loyverse System can any one help 

We use this function to send teh QR code to the Loyverse API 

 public function updateReceiptWithQRCode($receiptId, $qrCode)

    {

        try {

            Log::channel('loyverse')->info('Updating receipt with QR code', [

                'receipt_id' => $receiptId

            ]);

 

            $response = Http::withHeaders([

                'Authorization' => 'Bearer ' . $this->apiKey

            ])->post($this->baseUrl . '/receipts/' . $receiptId . '/notes', [

                'note' => "JoFotara QR Code: " . $qrCode,

                'print_on_receipt' => true,

                'print_on_order_ticket' => false,

            ]);

 

            Log::channel('loyverse')->debug('Loyverse API response', [

                'status' => $response->status(),

                'body' => $response->json()

            ]);

 

            if (!$response->successful()) {

                $errorData = $response->json();

                Log::channel('loyverse')->error('Loyverse API Error', [

                    'status' => $response->status(),

                    'response' => $errorData,

                    'error_message' => $errorData['message'] ?? 'Unknown error'

                ]);

                throw new \Exception('Failed to update receipt with QR code');

            }

 

            Log::channel('loyverse')->info('Successfully updated receipt with QR code', [

                'receipt_id' => $receiptId

            ]);

 

            return true;

 

        } catch (\Exception $e) {

            Log::channel('loyverse')->error('Error updating Loyverse receipt with QR code', [

                'receipt_id' => $receiptId,

                'message' => $e->getMessage(),

                'trace' => $e->getTraceAsString()

            ]);

Loyverse Point of Sale

 

 

 

 

×
×
  • Create New...