Adnan_Mughal Posted March 12, 2021 Share Posted March 12, 2021 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. Link to comment Share on other sites More sharing options...
Jay Rock Posted March 12, 2021 Share Posted March 12, 2021 (edited) 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 March 12, 2021 by Jay Rock Link to comment Share on other sites More sharing options...
Adnan_Mughal Posted March 12, 2021 Author Share Posted March 12, 2021 (edited) 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 March 12, 2021 by Adnan_Mughal Link to comment Share on other sites More sharing options...
Jay Rock Posted March 13, 2021 Share Posted March 13, 2021 Why in payment_type_id all letters uppercase register? Link to comment Share on other sites More sharing options...
Adnan_Mughal Posted March 15, 2021 Author Share Posted March 15, 2021 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. Link to comment Share on other sites More sharing options...
Featured Comment Jay Rock Posted March 15, 2021 Featured Comment Share Posted March 15, 2021 (edited) Please add square brackets. Edited March 15, 2021 by Jay Rock remove toolbar Link to comment Share on other sites More sharing options...
Adnan_Mughal Posted March 15, 2021 Author Share Posted March 15, 2021 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Posted by Jay Rock,
0 reactions
Go to this post