get customers orders using API
-
Hello, I am integrating Bagisto to a NEXTJS frontend and following the REST API documentation.
I am currently unable to get the customers' orders tested using POSTMAN. I am passing the token to the header but getting the unauthenticated error.
How do I solve this please?
-
Did you fix this?
-
@boragnit Not yet.
-
Hello there,
Please provide the correct path. Customer orders view path is-
{{base_url}}/api/v1/customer/orders
If you still facing the same please let us know.
Thanks. -
@Amitk-Webkul Thanks for the response. I am currently using Bagisto version 1.3.1 and using the V1 prefix returns a 404 error when accessing the API endpoints.
-
Hello there,
"Upon reviewing the API, I've noticed that the prefix is not capitalized and there seems to be a missing authorization. These are important aspects that should be addressed for proper functionality and security.
Please let me know if you still facing the same.
Thanks. -
@Amitk-Webkul Can you please tell me how to fix this?
-
Hello there,
Please update the API URL by capitalizing the prefix (V1), and then try authenticating again.
If you encounter any further issues. please let me know.
-
-
@Amitk-Webkul I can authenticate on this version of Bagisto 1.3.1. The problem is not able to get the customer's orders using the orders endpoint.
Upon testing it does not require the 'V1' prefix as required for Bagisto 1.5.1
-
Hello there,
Could you please let me know if there have been any customizations made to your project? This information will help me provide you with the most accurate assistance or recommendations moving forward.
-
-
@Amitk-Webkul said in get customers orders using API:
Hello there,
Could you please let me know if there have been any customizations made to your project? This information will help me provide you with the most accurate assistance or recommendations moving forward.
I am using a fresh install of Bagisto for this purpose.
-
-
@Amitk-Webkul Hello, any update with this?
-
Hello,
Let me some time to find the precise solution.
Thanks.
-
@Amitk-Webkul said in get customers orders using API:
Hello,
Let me some time to find the precise solution.
Thanks.
I am currently working on the checkout flow. I am able to checkout successfully as a guest but I am getting a 500 error when I hit the save-order endpoint with an authenticated user.
I am passing the JWT token. Can you please tell me what could be wrong? @Amitk-Webkul
-
@adebayoade
Hello there, can you please share the endpoints and screenshot where you are facing the issue, Also do share the screenshots of the Requests which you are passing in Postman.Thank you
-
@ashish2409 It worked while testing in Postman but got the 500 error from the Axios request on the front end.
I have no problem with the save shipment, save address, and save payment endpoints from the Axios request.
I get the 500 error when I try to save the order which is the last step.
Note that all endpoints worked without issues as a guest.
Authenticated:
Guest:
-
@adebayoade @Amitk-Webkul @ashish2409 I don't know where the error is coming from but it seems to be failing the Cart::hasError() check on the backend.
Please have a look at my get cart response to see why I can't save the order.
{ "data": { "rates": [ { "carrier_title": "Flat Rate", "rates": [ { "id": 1348, "carrier": "flatrate", "carrier_title": "Flat Rate", "method": "flatrate_flatrate", "method_title": "Flat Rate", "method_description": "Flat Rate Shipping", "price": 10, "formated_price": "\u20a610", "base_price": 10, "formated_base_price": "\u20a610.00", "created_at": "2023-10-21T08:55:31.000000Z", "updated_at": "2023-10-21T08:55:31.000000Z" } ] }, { "carrier_title": "Free Shipping", "rates": [ { "id": 1349, "carrier": "free", "carrier_title": "Free Shipping", "method": "free_free", "method_title": "Free Shipping", "method_description": "Free Shipping", "price": 0, "formated_price": "\u20a60", "base_price": 0, "formated_base_price": "\u20a60.00", "created_at": "2023-10-21T08:55:31.000000Z", "updated_at": "2023-10-21T08:55:31.000000Z" } ] } ], "cart": { "id": 470, "customer_email": "[email protected]", "customer_first_name": "Toyo", "customer_last_name": "Si", "shipping_method": "flatrate_flatrate", "coupon_code": null, "is_gift": 0, "items_count": 1, "items_qty": "1.0000", "exchange_rate": null, "global_currency_code": "NGN", "base_currency_code": "NGN", "channel_currency_code": "NGN", "cart_currency_code": "NGN", "grand_total": "14010.0000", "formated_grand_total": "\u20a614,010", "base_grand_total": "14010.0000", "formated_base_grand_total": "\u20a614,010.00", "sub_total": "14000.0000", "formated_sub_total": "\u20a614,000", "base_sub_total": "14000.0000", "formated_base_sub_total": "\u20a614,000.00", "tax_total": "0.0000", "formated_tax_total": "\u20a60", "base_tax_total": "0.0000", "formated_base_tax_total": "\u20a60.00", "discount": "0.0000", "formated_discount": "\u20a60", "base_discount": "0.0000", "formated_base_discount": "\u20a60.00", "checkout_method": null, "is_guest": 0, "is_active": 1, "conversion_time": null, "customer": null, "channel": null, "items": [ { "id": 762, "quantity": 1, "sku": "fifa22", "type": "simple", "name": "Fifa 22", "coupon_code": null, "weight": "0.6000", "total_weight": "0.6000", "base_total_weight": "0.6000", "price": "14000.0000", "formated_price": "\u20a614,000", "base_price": "14000.0000", "formated_base_price": "\u20a614,000.00", "custom_price": null, "formated_custom_price": "\u20a60", "total": "14000.0000", "formated_total": "\u20a614,000", "base_total": "14000.0000", "formated_base_total": "\u20a614,000.00", "tax_percent": "0.0000", "tax_amount": "0.0000", "formated_tax_amount": "\u20a60", "base_tax_amount": "0.0000", "formated_base_tax_amount": "\u20a60.00", "discount_percent": "0.0000", "discount_amount": "0.0000", "formated_discount_amount": "\u20a60", "base_discount_amount": "0.0000", "formated_base_discount_amount": "\u20a60.00", "additional": { "product_id": 178, "quantity": 1, "token": "true" }, "child": null, "product": { "id": 178, "sku": "fifa22", "type": "simple", "name": "Fifa 22", "url_key": "fifa-22-1", "price": "14000.0000", "formated_price": "\u20a614,000", "short_description": "<p>Fifa 22 game<\/p>", "description": "<p>Best football game<\/p>", "images": [ { "id": 265, "path": "product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "url": "http:\/\/localhost\/dev-saleko\/public\/storage\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "original_image_url": "http:\/\/localhost\/dev-saleko\/public\/storage\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "small_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/small\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "medium_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/medium\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "large_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/large\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg" } ], "videos": [], "base_image": { "small_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/small\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "medium_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/medium\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "large_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/large\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg", "original_image_url": "http:\/\/localhost\/dev-saleko\/public\/cache\/original\/product\/178\/A8pSpUcbpThCb6u3v8OCdMCtO2YhvhkRIstSXEnI.jpg" }, "created_at": "2022-08-04T15:03:39.000000Z", "updated_at": "2022-08-04T15:03:39.000000Z", "reviews": { "total": 1, "total_rating": "5", "average_rating": "5.0", "percentage": "{\"5\":100,\"4\":0,\"3\":0,\"2\":0,\"1\":0}" }, "in_stock": true, "is_saved": false, "is_wishlisted": false, "is_item_in_cart": true, "show_quantity_changer": true, "special_price": "14000.0000", "formated_special_price": "\u20a614,000", "regular_price": 16000, "formated_regular_price": "\u20a616,000", "on_sale": 1 }, "created_at": "2023-10-21T08:51:27.000000Z", "updated_at": "2023-10-21T08:55:32.000000Z" } ], "selected_shipping_rate": { "id": 1348, "carrier": "flatrate", "carrier_title": "Flat Rate", "method": "flatrate_flatrate", "method_title": "Flat Rate", "method_description": "Flat Rate Shipping", "price": 10, "formated_price": "\u20a610", "base_price": 10, "formated_base_price": "\u20a610.00", "created_at": "2023-10-21T08:55:31.000000Z", "updated_at": "2023-10-21T08:55:32.000000Z" }, "payment": { "id": 346, "method": "cashondelivery", "method_title": "Cash On Delivery", "created_at": "2023-10-21T08:54:44.000000Z", "updated_at": "2023-10-21T08:54:44.000000Z" }, "billing_address": { "id": 679, "first_name": "Toyo", "last_name": "Si", "name": "Toyo Si", "email": "[email protected]", "address1": [ "2 Test St" ], "country": "NG", "country_name": "Nigeria", "state": "LG", "city": "Ikeja", "postcode": "101233", "phone": "+123456789", "created_at": "2023-10-21T08:51:45.000000Z", "updated_at": "2023-10-21T08:55:31.000000Z" }, "shipping_address": { "id": 680, "first_name": "Toyo", "last_name": "Si", "name": "Toyo Si", "email": "[email protected]", "address1": [ "2 Test St" ], "country": "NG", "country_name": "Nigeria", "state": "LG", "city": "Ikeja", "postcode": "101233", "phone": "+123456789", "created_at": "2023-10-21T08:51:45.000000Z", "updated_at": "2023-10-21T08:55:31.000000Z" }, "created_at": "2023-10-21T08:51:27.000000Z", "updated_at": "2023-10-21T08:55:32.000000Z", "taxes": "{\"0\":0}", "formated_taxes": "{\"0\":\"\\u20a60\"}", "base_taxes": "{\"0\":0}", "formated_base_taxes": "{\"0\":\"\\u20a60.00\"}", "formated_discounted_sub_total": "\u20a614,000", "formated_base_discounted_sub_total": "\u20a614,000" } } }