highsidelabs / walmart-api-php

PHP SDK for Walmart's Marketplace Partner, Content Provider, and 1P Supplier APIs.
https://highsidelabs.co
BSD 3-Clause "New" or "Revised" License
25 stars 21 forks source link

Walmart CA Api is not working. #5

Open loveisbluenova opened 1 year ago

loveisbluenova commented 1 year ago

I tried get all orders with Walmart Canada API, but authorized is failed. Exception when calling OrdersApi->getAllOrders: [401] {"error":[{"code":"UNAUTHORIZED.GMP_GATEWAY_API","field":"UNAUTHORIZED","description":"Unauthorized","info":"Unauthorized token or incorrect authorization header. Please verify correct format: \"Authorization: Basic Base64Encode(clientId:clientSecret)\" For more information, see https://developer.walmart.com/#/apicenter/marketPlace/latest#apiAuthentication.","severity":"ERROR","category":"DATA","causes":[],"errorIdentifiers":{}}]} I think consumerId and privateKey is not working for authorization. Also I'm not sure how to use "WM_CONSUMER.CHANNEL.TYPE" in API header.

jlevers commented 1 year ago

That auth error is kind of strange, since as you mentioned in #3, the CA marketplace doesn't support client ID/client secret. Since I don't have any CA credentials, this is pretty hard for me to debug, but if you want to share yours with me to speed up the process, my email is [first name] [at] highsidelabs.co.

I see from the docs that the WM_CONSUMER.CHANNEL.TYPE header is required in CA – it's not the US, so I didn't build it into the library. I'll find a way to make the requirement for it country-specific.

jlevers commented 1 year ago

You can now pass a channelType key/value pair to the Configuration constructor, in v0.4.1. Give that a shot and let me know if it solves your issue.

quocvu88 commented 1 year ago

I have the same issue. I already put channelType, consumerID and private key but alway return an exception with "Exception when calling ItemsApi->getAllItems: [0] [NULL response]" mesage. Can you please help me to check! Thank you!

jlevers commented 1 year ago

@quocvu88 just to confirm, you're also doing this in the CA marketplace? Since I don't have CA credentials, this is difficult for me to test, but if you're willing to let me use yours to test I'm happy to try and figure out what's going on here. Feel free to shoot me an email at [first name] [at] highsidelabs.co.

quocvu88 commented 1 year ago

Hi @jlevers, Yes, I am doing this in CA marketplace. I sent you an email with my credential. Thank you!

jlevers commented 1 year ago

Thanks for the creds @quocvu88, those have been very helpful.

The latest release solves part of the issue here – signature-based authentication is working properly now – but Walmart's models are quite bad, especially for XML responses, so the CA getAllOrders call still isn't deserializing properly. I'll continue to work on it.