Jump to content

I'm trying to upload image of items via Loyverse API


Recommended Posts

We have suffering error when try to upload image of item.


        $path = base_path() .'/public'. $itemImage->photo;

        $file = file_get_contents($path);

        $dataBinary = base64_encode($file);

                    $curl = curl_init();

                    curl_setopt_array($curl, array(

                    CURLOPT_URL => 'https://api.loyverse.com/v1.0/items/89a38ddc-e810-465b-a174-15c2245adfdf/image',

                    CURLOPT_RETURNTRANSFER => true,

                    CURLOPT_ENCODING => '',

                    CURLOPT_MAXREDIRS => 10,

                    CURLOPT_TIMEOUT => 0,

                    CURLOPT_FOLLOWLOCATION => true,

                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

                    CURLOPT_CUSTOMREQUEST => 'POST',

                    CURLOPT_POSTFIELDS => $dataBinary,

                    CURLOPT_HTTPHEADER => array(

                        'Content-Type: image/png',

                        'Content-Length: 1000',

                        'Authorization: Bearer b94601bb9cfb44edbcxxxxxxxxxxxxxxxxx',



                $response = curl_exec($curl);


                echo $response;






Please provide solution as soon as possible...

Thank You

Team Geoalgo

Link to comment
Share on other sites

Please try the same using Postman or any other sender with user interface, send to me example request and responses. It will help, find issue more faster. I'm not super familiar with php.

Link to comment
Share on other sites

  • 1 year later...

Loyverse Point of Sale





  • Create New...