Google Play Developer API purchases.subscriptions doesn't return emailAddress field - ionic-framework

I'm integrating with Google Play Developer API (https://developers.google.com/android-publisher). To be more specific I'm trying to get informations about a specific subscription (https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get).
Well I'm already getting informations about a subscription with the subscriptionId and purchaseToken. The problem is that some fields are not being returned in response. One of these field is emailAddress that importante for my usage context. I'm getting a response like the one shown below.
{
"startTimeMillis": "1631112305355",
"expiryTimeMillis": "1638981894973",
"autoRenewing": true,
"priceCurrencyCode": "BRL",
"priceAmountMicros": "39990000",
"countryCode": "BR",
"developerPayload": "",
"paymentState": 1,
"orderId": "GPA.9999-5849-9341-89139",
"acknowledgementState": 1,
"kind": "androidpublisher#subscriptionPurchase"
}
From the docs about emailAddress we have The email address of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'.
But what is Subscribe with Google? Isn't Google Play Billing in this category? My purchases are made on an Android mobile app with Play Billing.
Thanks any help.

Subscribe with Google is a completely different thing that Google offers or at least used to offer, these are not normal subscriptions, for normal subs you do not get the users email.
Subscribe with Google lets you buy a subscription, using your Google
account, on participating news sites. Select the publisher offer you’d
like to buy, click “Subscribe,” and you’re done. You’ll automatically
be signed in to the site, and you can pay–securely and privately—with
any credit card you’ve used with Google in the past.
https://blog.google/outreach-initiatives/google-news-initiative/introducing-subscribe-google/

Related

Why is PayPal REST api pay by credit card option showing on desktop, not showing on mobile?

After a lot of digging around I have finally managed to get something working with the PayPal REST API, the documentation is awfully confusing.
I'm creating a C#/MAUI mobile app where I need to take payments.
Anyway, I managed to get the PayPal API it to create this URL, below (I can simulate the same thing using Postman)
https://www.sandbox.paypal.com/checkoutnow?token=XXXXXXXXXXXXX
Get an access token (access_token) using the REST API
POST to https://api-m.sandbox.paypal.com/v2/checkout/orders/ this payload
{
"intent": "CAPTURE",
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
]
}
The returned payload gives me this json. There are other kinks in the returned payload but this is the one I need.
{
"href": "https://www.sandbox.paypal.com/checkoutnow?token=XXXXXXXXXX",
"rel": "approve",
"method": "GET"
}
Using that URL, on a desktop PC browser I get the option to log-in or "pay by debit or credit-card" but on mobile browser I only get the option to create an account or log-in to an existing account, using that exact same URL.
Does, anybody know whats going on here? How do I get the same options in a mobile browser. I can't find anything in the documentation that explains this behaviour.
Guest availability in the paypal.com checkout depends on very many factors, including the IP address and geographic location of the buyer, the amount of the transaction, the device used, and any number of other things. Other than disabling guest as a possibility in your account options, you cannot control this behavior of the PayPal page.
A 'Debit or Credit Card' button on your own page can be added using the JS SDK for approval, rather than redirecting away. Here is a demo, which would fetch the created order id/token from your server.

Get current User in MS Teams for Bots

I have a general question about ms teams, bots and get current user values like email or ad id.
The background is a bot integrated in teams. He is for general working and send some json informations to the bot (not based on ms bots framework). I can see this in my bot. What I see is my name some crypted ids and some other values more or less senseless for me. I am working with ms teams toolkit first and I see no direct way to integrate other values to the initial bot chat.
I can't see my email address or my ad id. Which one I want have inside the the bot as value without any question for sending an email back to the user.
I read the docs from ms about messaging, but they are not very helpful.
My question: how can I integrate additional values from the current teams session like email device name into the initial bot chat?
You haven't mentioned what language you're using, but I'm presuming Node given that you're using Teams Toolkit. In your bot, inside the various event handlers, there's a context object. On that object, you can access context.activity.from which has things (for example):
"from": {
"id": "29:[some long id]",
"name": "[user's name]",
"aadObjectId": "[this is the user's Azure Ad Object Id]"
},
So aadObjectId should match what you're looking for, "AD ID". To get the user's email, you need to make another call, as per here.

How to get purchaseHistory for IAPs with BillingClient

As the documentation says:
queryPurchaseHistoryAsync():
Returns the most recent purchase made by the user for each SKU, even if that purchase is expired, canceled, or consumed.
So lets say I would like to make an IAP for the user to remove Ads forever from my app.
How do I decide with a fresh install if that user already purchased that IAP if this function also returns the "canceled" IAPS?
I would like to query the actually purchased IAPS, not everything. Becuase that way a user could unlock the Ad free version with a cancelled IAP.
To make it worse, the Purchase class doesn't have status like "cancelled" or "consumed" I cannot decide the state of the user's purchased IAPS.
Am I missing something here?
Thanks in advance
The billing client documentation states it checks for the user.
Then we have the question: Who is the user
If you look at the steps taken for the billing api on https://developer.android.com/google/play/billing/billing_library_overview then you see that a connection to google play is needed.
What happens then is that the current user on android, the account they are signed in with on google play and their mobile device is determined to be the user.
So if they purchased it via google play in app, it will always be assigned to that user on google play and that is what's being queried by this. No matter on which device they are logged in, Their tablet, smartwatch, phone, television, etc...
How to get a list of actually bought products
Instead of using async that gives you everything included abandoned shopping carts I suggest you use https://developer.android.com/reference/com/android/billingclient/api/BillingClient#querypurchases
That way Get purchases details for all the items actually bought and paid within your app. This method uses a cache of Google Play Store app without initiating a network request.
Note: It's recommended for security purposes to go through purchases
verification on your backend (if you have one) by calling the
following API:
https://developers.google.com/android-publisher/api-ref/purchases/products/get
If you read that API link it's easy to check with the online cache if the purchase was valid with a simple GET request.
Personally I would build in a check if the phone is suspect to be rooted before doing the manual background check with the purchases API that sends a request to the store.
Phones that are not rooted have a higher trust level, as the user are probaly not very tech savvy and will not have a shimmer of a clue how to circumvent such checks, and the google play cache will be updated regularly, reflecting trustworthy data.
When a phone is suspect to be rooted(you can read protected directories/write to them), then perform the check online if they bought the stuff each time you deem it neccesary.

How can I get owner email for a Facebook App using the App Access Token

How would I get the email address associated with an active Facebook App ID, if all the usual methods (such as here, and here) don't return any email information with my creator-uid?
(I simply don't get the email field returned, even when I specifically request it as per here. I don't think this is a case of this as I didn't get an "App has no owner" error, or any error whatsoever.)
I've also tried this, but I'm in a catch-22 as I can't log in to select the application first.
I'm looking for the owner email address, so I can log in to make administrative updates following graph API updates.
Other specifics:
I get the following when I hit the Graph API via: https://graph.facebook.com/{my-app-id}?access_token={my-access-token} or https://graph.facebook.com/{my-app-id}?access_token={my-access-token}&fields=email
{
"name": "my-name",
"id": "my-creator-uid" }
I've tried to recover my FB account using all emails I can think of, but FB says 'no account exists' for each that I try. (This is a data-analytics corporate account being used to gather data for 12+ months, so I can't simply create a new account/app ID and start using that instead, as app-scoped user IDs will change.)
I've also tried viewing https://www.facebook.com/app_scoped_user_id/{my-creator-uid}/ and https://www.facebook.com/{my-creator-uid}/ from another company FB account, but both get:
Sorry, this content isn't available right now The link you followed
may have expired, or the page may only be visible to an audience
you're not in.
What else would you suggest? What might have happened? I've tried to contact Facebook, but that search led me to this forum post, so I'm here. Thank you in advance for your help.
This is not a programming question, try to get in touch with the Facebook Team, if you are working with Facebook paid services (like Advertising) you might have an account representative that can accelerate the things a little bit (But this can be a really long wait).
A more realistic option is to create a new profile and an new app, also your application will be reviewed as well (Take a little less time than previous option).

How to implement auto renew subscription in app billing google play

I'm researching method to implement auto renew subscription in app billing with google play. I read https://developer.android.com/google/play/billing/billing_subscriptions.html and see
Billing continues indefinitely at the interval and price specified for the subscription. At each subscription renewal, Google Play charges the user account automatically, then notifies the user of the charges afterward by email. For monthly and annual subscriptions, billing cycles will always match subscription cycles, based on the purchase date. (Seasonal subscriptions are charged annually, on the first day of the season.)
When the subscription payment is approved, Google Play provides a purchase token back to the purchasing app through the In-app Billing API. Your apps can store the token locally or pass it to your backend servers, which can then use it to validate or cancel the subscription remotely using the Google Play Developer API.
So have any method to my server know when user's subscription was renewed? Instead of google play send new bill subscription to android app after that android app send this new bill to my server just for validate.
Can google play send a notify to my server when user's subscription renewed such as notify the user by email ? I want to google play send me a notify that user's subscription was renewed automatically so that my backend will update expire their subscription in app increase. Don't need android app have to check bill each time user open store to check have new bill from goole play charge automation or not. Do it implement?
My workfollow
Google charge a new cycle subscription and notify to my server { body such as bundId, bill, product_id or subscription package name, expire date...), also sent mail to user about their subscription automation renewed.
My server determine change subscription of the user and validate in app purchase by google play api and change expire package subscription in your app if validate is valid.
Store newest bill in my db
Is that possible?
[Update] Recommend from goolge play api doc
Recommendation: Include business logic in your app to notify your
backend servers of subscription purchases, tokens, and any billing
errors that may occur. Your backend servers can use the server-side
API to query and update your records and follow up with customers
directly, if needed.
How to implement recommend from google api, any doc or tutorials ?
I have currently exactly the same problem. The concept of Google is not well-conceived. There is a possibility to notify your backend server about financial transactions (see here), but I would not recommend this. You rely your business transactions on a lot of Google services and your server uptime. If anything goes wrong or is down or something, you will not be informed and your backend business logic does not work anymore.
This recommendation of Google you mentioned sucks as well. What happens if there is an auto-renawal (which delivers a new purchaseToken to your app) and the user never opens your app. Then the new subscription data will never be transferred to your server. And if you never got a new token, how can you check, if the user is still a subscriber, since this limited Google Play Developer API stupidly needs a purchaseToken as parameter (see here) that you never get as long as the user does not open your app at least once after an auto-renewal (to submit it to your server).
I think about implementing this in this way:
1.) I continuously check the purchase records by cron job. A purchase record is a database entry which contains all data from the initial subscription (orderId, purchaseToken, and so on, all that is needed for the security validation process on the server). Every purchase record is connected to a user's account (some UserID) in my backend system. As long as the autoRenewing attribute of the purchaseRecord is not false, the subscription is valid. Even if the expiryTimeMillis is exceeded, this one user could still have a valid subscription, because of the use case I described above: Subscription will be auto-renewed by Google, but the user never opens the app, so no transfer token is sent to your server and you are still not informed about the subscription update.
2.) If the use cancels his subscription any when, the autoRenewing would be false at any time. That means that the subscription will indeed end at the expiryTimeMillis.
3.) When the user opens your app and transfers the new purchaseToken to your backend, you will get a new purchase record which is again connected to the user account with his User ID. The user will probably have 2 purchase records now. The old one and the new one. If so, you could delete the old one, and the same process repeats with the new purchase record at step 1.
I didn't have implemented the concept so far, so I don't know if this really works like this. Maybe this could work in a different manner, but maybe it's a step into the right direction.
I don't think, relying upon daily basis cronjob is a feasible way to go about this problem, It is messy and you have to also consider the case when your application is handling too many requests, you have a limit of transactions that made using android developer's api. The better way to implement it would be to use google's recommendation. Which stats:
...
Note: Due to quota restrictions, it is not recommended to check state by polling the Google Play Developer API at regular intervals instead of leveraging Real-time developer notifications.
...
Here, You can follow the following url
How to get expiry date for Subscription with client side in Android? and to implement the auto-renewal subscription.