aligent / bigcommerce-v3-api-php-client

PHP library to interact with the BigCommerce V3 API (https://developer.bigcommerce.com/api-reference#v3-rest-api)
GNU General Public License v3.0
13 stars 23 forks source link

cart data #195

Closed Mpese-Joao closed 1 year ago

Mpese-Joao commented 1 year ago

I want to kno if it is possible to access the cart data through the App? I'm asking because i'm developing an app to read cart data. But whenever a press the button i get 401 error:

const fetchBigCommerceData = async () => { try { const response = await fetch( "https://api.bigcommerce.com/stores/aherf0o3nw/v3/carts/{CartId}", { headers: { "Accept" : "application/json", "Content-Type" : "application/json", "X-Auth-Token" : "4, "X-Auth-Client" : "a", }, mode: "no-cors", } );

jswift commented 1 year ago

Not really related to this library (PHP API Client), but I would suggest using an API client like Postman to test the calls and understand the BigCommerce API. Also you need to know the ID of the cart you're fetching (either by extracting it from the the browser or because you created it), because there is no API to get all carts.

I'm not certain of your use-case, but perhaps you should be using the storefront cart api? (https://developer.bigcommerce.com/api-reference/213ddc6deee1f-get-a-cart)