Skip to content
View in the app

A better way to browse. Learn more.

Loyverse Town

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Unable to Create Receipt

Featured Replies

I am trying to create receipt by sending following data to this endpoint: https://api.loyverse.com/v1.0/receipts.

However, I am getting this error that I am not sending UUID in object.payments.

Error Message:

{"errors":[ {

         "code":"INVALID_VALUE_TYPE",

          "details":"The value must be an UUID",

          "field":"object.payments (line: 1, column: 369)"

}]}

My Request Data:

[
    'store_id' => '0de6be20-4008-4511-bfe5-d9b8854620e5',
    'order' => 250972528,
    'customer_id' => '62b73367-bcd8-49e7-ke8e-696947052c72',
    'source' => 'website',
    'receipt_date' => '2021-03-12T16:06:12.000Z',
    'note' => NULL,
    'total_discounts' => [],
    'line_items' => [
      0 => [
        'variant_id' => '62955a68-38fa-45ad-bd3e-68c9985fbe96',
        'quantity' => 1,
        'price' => 13,
        'cost' => 13,
        'line_note' => 'test order',
        'details' => '',
      ],
    ],
    'payments' => [
      'payment_type_id' => 'fc52f1b2-31cf-4f51-ba40-c165c1273282',
      'paid_at' => '2021-03-12T16:06:12.000Z',
    ],
]

I am sure that payment_type_id is in proper UUID format but I am completely stuck at this point coz there is no clue that what actually is with this request data.

Looks like your json covered by square brackets, like array of receipts.

In loyverse API endpoint /receipts recognize only single receipt in curly brackets.

like:

{

"store_id": "bfbbde8a-ceb5-4494-8968-24b446aa8ac7",

"employee_id": null,

"source": null,

"name": null,

"order": "257",

"receipt_date": null,

"customer_id": null,

"line_items": [

{

"variant_id": "dc64eea9-f218-489b-a505-3d29ed770144",

"quantity": 2,

"line_note": null,

"price": 300.0,

"line_taxes": []

}

],

"note": null,

"payments": [

{

"payment_type_id": "fc52f1b2-31cf-4f51-ba40-c165c1273282222",

"paid_at": null

}

]

}

Edited by Jay Rock

  • Author

Really thanks for quick reply Sir!

I double checked my request and it seems that request data that I posted originally is correct. You are seeing wrong brackets because I took it from my logs and pasted here. However, following is the JSON encoded version of that request:

{"store_id":"bfbbde8a-ceb5-4494-8968-24b446aa8ac7","order":250972528,"customer_id":"62f73367-bbd8-49e7-ae8e-696947052c72","source":"website","receipt_date":"2021-03-12T16:06:12.000Z","note":null,"total_discounts":[],"line_items":[{"variant_id":"62955a68-38fa-45ad-bd3e-68c9985fbe96","quantity":1,"price":13,"cost":13,"line_note":"test order","details":null}],"payments":{"payment_type_id":"FC52F1B2-31CF-4F51-BA40-C165C1273282","paid_at":"2021-03-12T16:06:12.000Z"}}  

Also, if brackets were wrong then error should be some "syntax" related but not UUID error.  

Edited by Adnan_Mughal

Why  in payment_type_id all letters uppercase register?

  • Author

Since, I was stuck and desperately wants to solve it so I did that intentionally, the actual dump that I am sending in Postman as following:

{
  "store_id": "bfbbde88-cebb-4494-8968-24b446aa8ac7",
  "order": 250972528,
  "customer_id": "62f73367-bbd8-49e7-ae8e-696947052c72",
  "source": "website",
  "receipt_date": "2021-03-12T16:06:12.000Z",
  "note": null,
  "total_discounts": [
  ],
  "line_items": [
    {
      "variant_id": "62955a68-38fa-45ad-bd3e-68c9985fbe96",
      "quantity": 1,
      "price": 13,
      "cost": 13,
      "line_note": "test order",
      "details": null
    }
  ],
  "payments": {
    "payment_type_id": "fc52f1b2-31cf-4f51-ba40-c165c1273282",
    "paid_at": "2021-03-12T16:06:12.000Z"
  }
}  

Please check screen shot for payment-id and response from the API. I strongly believes that there is same issue on the API's side where they are validating the UUID string which is sending that false error.

image.thumb.png.845c54775fe8069f8e502e40fd046c66.png

 

Please add square brackets.

 

Screenshot from 2021-03-15 17-22-01.png

Edited by Jay Rock
remove toolbar

  • Author

Wow, this actually resolved my problem. However, if error message pointed us to exact error like "REQUIRD PARAMETER SHOULD BE AN ARRAY" etc. Then it would be much better. Anyways, thank you.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.