woocommerce Rest API giving permission error while fetching orders from store - rest

I am using WP Rest API to fetch the orders from store using consumer key and secrete in URL but its giving me error of permission and order not be read.
Kindly anyone can suggest the solution for this issue that how i can debug and solve the issue
I am getting order using API in URL as follows
https://www.onetwocosmetics.com/wc-api/v3/orders/8082?consumer_key=MY_CONSUMER_KEY&consumer_secret=MY_CONSUMER_SECRETE
SO what i get in response is any error as follow:
{"errors":[{"code":"woocommerce_api_user_cannot_read_order","message":"You do not have permission to read this order"}]}
But when i get the products using the same API it is giving all the product but orders are not getting
https://www.onetwocosmetics.com/wc-api/v3/products/?consumer_key=MY_CONSUMER_KEY&consumer_secret=MY_CONSUMER_SECRETE

Its solved as the API required the Admin user KEYS not a simple user like Customer, Subscribers. and also check if you are not installed any permssion manager plugin on the site.

Related

Error message "{responseCode8,responseMessageERROR_INVALID_PAYMENTTOKEN}" is displayed when I call the API for verifying the purchase token

I made a request to verify the purchase token by referring to the official materials, but error message "{responseCode 8 , responseMessage ERROR_INVALID_PAYMENTTOKEN}" was returned. The URL of the request API was {rootUrl}/applications/purchases/tokens/verify. Is there anyone who can help me with this problem?
First, you need to make sure that consuming or confirming a product is performed for a user only when the user has successfully purchased it, that is already owned the product.
Then you also need to ensure that the input parameters in the API call request are correct.
For example,use the wrong site to check that purchaseToken.or The productID is not added to the PMS or is incorrect. and so on.
For more details,you can refer to error codes.

Verify if order id exists

I redirect the user to a page with the Smart Payment Buttons passing the order id in the URL
example.site?orderid=D23F34492211
But if the user changes the URL, the JavaScript will fetch an id that doesn't exist. Eventually, the transaction will not be completed, however, it will just close the PayPal's lightbox as well as the credit card option, without giving any error message.
The error it throws is something as following:
Fatal error: Uncaught PayPalHttp\HttpException: {"name":"RESOURCE_NOT_FOUND","details":[{"issue":"INVALID_RESOURCE_ID","description":"Specified resource ID does not exist. Please check the resource ID and try again."}],"message":"The specified resource does not exist.","debug_id":"9d62d83a871b8","links":
Is there any way to get this response as JSON or get the error code from the API and show an error message to the user? If not, what's the best way to verify whether the order id exists or not?
You shouldn't be passing the order ID via a URL, you should be fetching it from your server. Then you will know it is valid.
Anyway, your question is bout verifying the status of an order ID via an API call. It is not necessary to do this. You should not have to do this. But if you insist on doing it, there is an API call you can use. https://developer.paypal.com/docs/api/orders/v2/#orders_get
This API call should be run from your server, so if you want to call it from the client, you will need to build a middleware endpoint route on your server. (Again, there is no point to doing this and it would be wasted effort)
The actual proper way to do things is to fetch the order ID from your server, as mentioned: https://developer.paypal.com/demo/checkout/#/pattern/server

PayPal REST API - Get Sale by Transaction ID - The requested resource ID was not found (404)

I am essentially trying to get the details of any transaction ID in my PayPal account to authenticate users I am migrating to a new authentication system.
I am using the PayPal Rest API so: http://puu.sh/gdb3T/461dde2928.png and yes I have checked everything is fine, it is infact set to live with the correct id / secret.
This isn't exactly an answer to this specific question, but I have simply fixed it by using PayPal's classic API in order to get the job done.
Kind of strange the rest API doesn't let me do this.

How to retrieve multiple user account details through their Facebook IDs in graph API?

This could be a duplicate of here and here, but can some one provide a complete working example for following.
I have set of different Facebook account Ids, and i need to get the respective account details(user name etc) from these account ids. I need to send a Batch Request for Graph API. Something as follows,
(https://graph.facebook.com?ids=user1, user2, user3,...)
Is this possible as pure HTTP GET request ?
I am using Facebook SDK with Android for the moment. I have gone through the API doc but unable to build the required query yet. Please help.
Maybe post a snippet of your code so we can try to solve your problem better. With the info you provided, the URL https://graph.facebook.com/?ids=user1,user2,user3 works just fine and returns 3 users.
The URL format looks correct. Keep in mind the total character limit, but otherwise I suspect you are stuck in a different place (e.g. sending the query or saving the result).

Google APIs Console: Error Creating OAuth 2.0 Client ID

I am trying to use the Google APIs Console to create an OAuth 2.0 Client ID as a Service Account. This ID will be used to query my Google Analytics data through the Analytics API. However, when I attempt to create the Client ID, the APIs Console displays the message, "An error has occurred. Please retry later." I have tried several times throughout the last two weeks, but I keep getting the same error message. Can anyone advise me on what I'm doing wrong? Or is there another way that I can access my Analytics data via the API without an OAuth Client ID?
I figured out the issue. Apparently, the Google APIs Console does not allow a collaborator account to create new OAuth Service Accounts, only the owner account can do so.