Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting success/fail response information from AndroidPublisher->purchases_products->acknowledge() #497

Open
nibbleshrew opened this issue Sep 18, 2021 · 2 comments
Labels
type: question Request for information or clarification. Not an issue.

Comments

@nibbleshrew
Copy link

I have been banging my head against a wall on this question. I can't find any examples anywhere of how to check the result of an in-app billing acknowledge call for one-time purchases and subscriptions.
The Google docs for the basic REST api call state the response body will be empty on success. It doesn't say anything about errors and I can't find anything on errors in the client libraries.

Using the pattern...

$client = new Google\Client();
$service = new Google\Service\AndroidPublisher($client);
$service->purchases_products->acknowledge(..params..);

I figure there must be a way to get a better status indicator for success than just an empty response as an empty response could also just be a failed attempt. If there are errors then what form does that messaging take?
If I've missed some docs you can point me too, I'll happily read those.
Thank you.

@bizmate
Copy link

bizmate commented Sep 19, 2021

an empty response as an empty response could also just be a failed attempt

A response is first of all a HTTP response. As such it uses https://datatracker.ietf.org/doc/html/rfc2616#section-6.1.1
The client will tell you by response code what happened.

I it not uncommon to just return 201 or 202 depending on the meaning it is delivering

@danoscarmike danoscarmike added the type: question Request for information or clarification. Not an issue. label Sep 23, 2021
@nibbleshrew
Copy link
Author

I have figured out a few things and have got closer to an solution. As I have seen often reported by others on forums, the google docs are not terribly helpful to a beginner starting out with Google API's and in-app purchases (especially if you're not using java or python).

I figured out that the api user registered in the credentials has to have access to financial permissions turned on in the Play Console. Also that you have to turn on Developer API access in the cloud project system. After doing that I was finally able to execute a call to Method: purchases.subscriptions.acknowledge and inspect what the library was returning: GuzzleHttp\Psr7\Response Object and see the properties.
So from that object I was finally able to call $oGuzzleResponse->getStatusCode() to get the http status code (This is what I was asking for originally, how to get to the status code).

So the last item I am lacking is a list of the possible response codes and what they mean for success or failure. The REST resources page doesn't talk about this or give any links to a resource for it. (https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/acknowledge0.
For instance... what constitutes a success code: 200, 201, 202? Anything under 300? What are the error statuses and their meanings. If someone has a link to the doc page that would be great. I just need a starting hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants