How to use google play order status api in php - php

I am trying to fetch order status in real time in php but not able to find proper way or documentation so I can go ahead.
In sales api I am getting details of sold subscription, but I want payment pending and cancelled orders too.
In Documentation I got below link
https://developers.google.com/android-publisher/api-ref/rest/v3/monetization.subscriptions/list
Gets below output when I run it in Try this method
{
"error": {
"code": 403,
"message": "The project ID used to call the Google Play Developer API has not been linked in the Google Play Developer Console.",
"status": "PERMISSION_DENIED"
}
}
But i am not able to implement it in PHP.

I had the same question so I raised a ticket and got reply that google play does not provide any API for order status, its available for kotlin and java only,

Related

Change the Status of a Sales Order in ExactOnline

We currently need to set the status of orders to CANCEL in ExactOnline through the API when they are cancelled in our shop.
I got through the ExactOnline API documentation and in the PUT request of salesOrders, I did not find any Status field that I can update but this field exists when this is a GET request. https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesOrderSalesOrders
My PUT request would have this body as status 45 = Cancelled.
{
"Status": 45
}
Which currently returns "204 No Content" (which is normal) BUT the status is not updated.
What would be the workaround then?
Thanks.
Have you tried using the PHP API client? https://github.com/picqer/exact-php-client if your API request is malformed, this might be an easier way to do it.
After some inquiry and discussions with ExactOnline team, updating the status of sales related things through API is not feasible.

YouTube Data API listChannels request sometimes won't return channel data for users with multiple channels

I'm using google-api-php-client to query YouTube Data API.
First, I get a token from a user with the following scopes:
[
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/youtube.readonly',
'https://www.googleapis.com/auth/yt-analytics-monetary.readonly',
'https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/youtubepartner',
'https://www.googleapis.com/auth/youtubepartner-channel-audit',
]
Then I make listChannels request:
(new \Google_Service_YouTube($client))->channels->listChannels('snippet', [
'mine' => 'true',
'maxResults' => 1,
]);
And most of the times it works like a charm. I get their channel data.
But sometimes it throws an exception with code 401 and the error message:
{
"error": {
"errors": [
{
"domain": "youtube.header",
"reason": "youtubeSignupRequired",
"message": "Unauthorized",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Unauthorized"
}
}
It looks like it happens for users who have multiple channels. But I tried adding a new channel to my personal account and choosing that new channel when authorizing access via OAuth. And it worked fine.
It's very confusing as far as why it happens, and the error message doesn't make much sense. Because their tokens are definitely fine, I can renew them or query their Google Plus profiles without problems.
Have anyone encountered that error?
Based from this documentation, youtubeSignupRequired indicates that the user has an unlinked Google Account, which means that the user has a Google Account but does not have a YouTube channel.
This error is commonly seen if you try to use the OAuth 2.0 Service Account flow. YouTube does not support Service Accounts, and if you attempt to authenticate using a Service Account, you will get this error.
The YouTube API blog post introducing Google Account support also discusses the youtubeSignupRequired error in more detail. Although the blog post explains the error for API version 2.1, the meaning of the error is still applicable.
Here are some related posts which might help:
Youtube API v3 return 401 when i try to upload video
Service account doesnt work with youtube. Also please ensure that if you are using a gmail ID it must be linked to youtube otherwise you would get 401.
Youtube v3 api 401 Unauthorized
The reason "youtubeSignupRequired" usually means the YouTube account has not been set up properly or you have not created your YouTube channel yet. This is a requirement before you can upload videos. It would be great if Google could improve their error message for this case and make it a bit more verbose.
Hope this helps!

PayPal Rest API (PHP SDK) webhooks not showing up in sandbox events list

When using the webhooks simulator, I get: Got Http response code 500 when accessing https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-6W4482673W002281V-61985753LP2332451
JSon info is being sent back to my site and I can parse it, but when trying to validate (validateAndGetReceivedEvent) - I get the above 500 error.
Also - when I try submitting an actual sandbox sale, the success return url shows me the sale went through, but a hook is never triggered. (I created a hook that has all events checked)
When I trace with error logs along the way (FYI -I use Codeigniter and I don't have the greatest debugging skills), things seems to come to a stop in PapPalRestCall->Execute
$connection = new PayPalHttpConnection($httpConfig, $config);
The event samples which you get from Simulator are sample payloads and does not correspond to actual transactions. If you try to fetch an event from sample payload, you won't be able to retrieve that.
{
"name": "INTERNAL_SERVICE_ERROR",
"details": [],
"message": "Internal service error"
}
This is correct and expected behavior. You may refer to this Response for Sample Webhook Event Retrieval

PayPal - Unable to verify the payment using Transaction ID (GetTransactionDetails API)

There are a lot of discussions about similar issues but I couldn’t find the exact answer.
Here is the problem:
I’m trying to integrate in-app payment in Android OS using the latest PayPal MSDK library. The integration was straight forward, I could make successful single payment, receive proper response and the things was OK until I have to verify the mobile payment
In the mobile app(using PayPalConfiguration.ENVIRONMENT_SANDBOX), I receive the following response:
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.2.2",
"platform": "Android",
"product_name": "PayPal-Android-SDK"
},
"response": {
"create_time": "2014-08-05T19:49:19Z",
"id": "PAY-0D205735ER3716140KPQTKPY",
"intent": "sale",
"state": "approved"
},
"response_type": "payment"
}
As you can see, the transaction ID is: PAY-0D205735ER3716140KPQTKPY
When I try to verify the payment by making request with this transaction ID from my server to PayPal, the response is always the same:
{
"Errors":
[
{
"L_ERRORCODE":"10004",
"L_SHORTMESSAGE":"Transaction refused because of an invalid argument. See additional error messages for details.",
"L_LONGMESSAGE":"The transaction id is not valid",
"L_SEVERITYCODE":"Error"
}
]
}
When I check in PayPal Sandbox test account site -> Notifications, the test transactions ids are completely different. For the above transaction, the transaction id is:
5DY75733624918945
If I use this transaction ID in my verification request – the response from the PayPal is OK.
According the documentation, I should use the id from the mobile app response (moreover – I do not know other way to retrieve a transaction id…).
I'm using a test sandbox account, tried with different type of payment (PayPal button and CC), tried even with real transactions - the result is the same.
Do you guys know why they are different?
Please take a closer look at https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
The SDK returns a payment ID which can be used to retrieve a payment resource using GET. The payment will contain one or more transactions (in your case, a single sale transaction) in the related_resources section.

Get JSON from a public Google Calendar

How can I get a JSON with the events of a public Google Calendar? I have it's ID but no acess to it. I don't want to change its events, nor log in.
I would like get a JSON from it to sync with my PHP/MySql database.
Tried https://www.googleapis.com/calendar/v3/calendars/{calendarId}
but got login error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Since November 17th 2014, v1 and v2 of the Google Calendar API have been disabled.
Google Calendar API V3 requires oauth authentication for almost all of its operations. As near as I can tell, this also requires user interaction.
However, for public calendars, it is still possible to use a single link to get JSON data (this is not currently documented by Google - I don't know if it's oversight on their part or private API that might disappear tomorrow).
Register your application with the Google Developers Console
Activate the Google Calendar API in the Google Developers Console.
Under Credentials, create a new Public API access key (you may want to leave referrers blank for testing)
The JSON url now looks like this
https://www.googleapis.com/calendar/v3/calendars/{calendarid}/events?key={Your Public API Key}
(The curly braces {} should not present in the actual url).
The API documentation describes additional parameters you can include (except that you can also include the parameter &callback=, as with most JSON requests, to create a JSONP response for javascript).
Your calendar have to be shared publicly!
This one works if you have shared only free/busy status:
http://www.google.com/calendar/feeds/{calendarId}#group.calendar.google.com/public/basic?orderby=starttime&sortorder=ascending&futureevents=true&alt=json
Full details - this one works only if calendar is shared fully publicly
http://www.google.com/calendar/feeds/{calendarId}#group.calendar.google.com/public/full?orderby=starttime&sortorder=ascending&futureevents=true&alt=json
Or just free-busy
http://www.google.com/calendar/feeds/{calendarId}#group.calendar.google.com/public/free-busy?orderby=starttime&sortorder=ascending&futureevents=true&alt=json
Parameters orderby, sortorder and futureevents are optional but might help you later :)

Categories