I have three different subscription purchases with different duration. I've configured test accounts and I can do test purchases. For those purchases Google doesn't charge me, but they look pretty much like real ones. When purchase is successfull, In-App Billing sends me some data about my purchase like packageName, productId, orderId, purchaseToken and so on.
In my handling code I need to know somehow if this purchase is real or not. In plain text: did I really earn money for it or was this purchase made by some test account and I earned for it nothing? I need this kind of info for purchases accounting.
So the question is: How do I distinguish between real and test subscription purchases in code?
Thanks.
P.S. I'm using Xamarin and C# for development.
You can make real purchase on a alpha/ beta version if your account is not added to licensed accounts list in your Google Play developer account.
Check this:
With alpha/beta test groups, real users (chosen by you) can install
your app from Google Play and test your in-app products. They can make
real purchases that result in actual charges to their accounts, using
any of their normal payment methods in Google Play to make purchases.
Note that if you include test license accounts in your alpha and beta
distribution groups, those users will only be able to make test
purchases.
UPDATE
To know which purchase is real and which is test one, check for orderId in response. No orderId will be assigned for test purchases.
Issue with Android IAP, no OrderID in Purchase Object
On the latest v3 Android Publisher API, you can obtain a SubscriptionPurchase object provided you have the Package name, SubscriptionId and the Token.
The SubscriptionPurchase object contains an optional (null-able) integer field named purchaseType. According to Google, when it is set and the value is 0, this is a Test subscription. I can confirm this works and matches the data I am getting back.
Here is the quote from Google's documentation:
// The type of purchase of the subscription. This field is only set if this purchase
// was not made using the standard in-app billing flow. Possible values are: 0.
// Test (i.e. purchased from a license testing account) 1. Promo (i.e. purchased
// using a promo code)
Related
My server receives a real-time developer notifications (RTDN) from Google Play. Now what?
How to check whether RTDN by Google Play comes from Google, not from a hacker? Suppose I use purchases.products.get API to check it. Then a hacker could send me repeated RTDN, what would lead my server into thinking that purchase happened two times (when it was really one time).
I want my server to top the user account on every purchase from my app. I want the amount of purchase to be arbitrary (specified by the user). Should I include the amount in dollars into product productId/SKU like: credit-$0.78?
Also, it is unclear how to determine the installation ID of the app (a UUID I store in app data on installation) for which the purchase was done. Should I include the UUID in productId/SKU?
Quoting https://developer.android.com/google/play/billing/security
A special case of sensitive data and logic that should be handled in the backend is purchase verification. After a user has made a purchase, you should do the following:
Send the corresponding purchaseToken to your backend. This means that you should maintain a record of all purchaseToken values for all purchases.
Verify that the purchaseToken value for the current purchase does not match any previous purchaseToken values. purchaseToken is globally unique, so you can safely use this value as a primary key in your database.
Use the Purchases.products:get or Purchases.subscriptionsv2:get endpoints in the Google Play Developer API to verify with Google that the purchase is legitimate.
If the purchase is legitimate and has not been used in the past, you can then safely grant entitlement to the in-app item or subscription.
[skipping about verification of subscriptions]
Real-time developer notifications (RTDN) is a mechanism to receive notifications from Google whenever there is a change in a user's entitlement within your app. RTDN leverages the use of Google Cloud Pub/Sub which is encoded and secure, each publish made to a Cloud Pub/Sub topic contains a single base64-encoded data field.
Note: You must call the Google Play Developer API after receiving Real-time developer notifications to get the complete status and update your own backend state. These notifications tell you only that the purchase state changed. They do not give you complete information about the purchase.
The Google Play Developer API is a server-to-server API that complements the Google Play Billing Library on Android. This API provides functionality not available in the Google Play Billing Library, such as securely verifying purchases and issuing refunds to your users.
I want to allow my users to pay food to my business users using Stripe Connect. I never used Stripe, but by reading the Stripe documentation, this seems feasible and relatively easy to implement.
According to this Google documentation page, the purchase or rental of physical goods via a given app is not subject to their fees.
Does this imply that I will not pay any fee to Google, even if I distribute my app via Google Play?
Given your use case, you should be able to use Stripe instead of Google Play's billing system and not be subject to Google extra fees. That being said, it would depend on how you implement your app. For example, if you were to sell tokens (that were only available in-app) that could be redeemed for food, that would probably still need to use Google's billing system. You should probably write in to Stripe Support (https://support.stripe.com/contact) to talk through what you want and be completely sure.
[Edited as suggested by #Nick. Also made clearer the problem I am having. Also done a further edit to explain further.]
In my app on the Google Play Dashboard I have created an in app purchase called test1. So what is the product id I put in the following?
String productString = "test1";
bp.purchase(this, /* "YOUR PRODUCT ID FROM GOOGLE PLAY CONSOLE HERE" */ productString);
The purchase function is from Android In-App Billing v3 Library as noted by #Nick .
The error I am getting when I just have productString = "test1"; is it is saying:
Error
The item you requested is not available for purchase
When I do: bp.purchase(this, "com.mywebsite.jon.myappname.test1"); to make it look as much as possible like the test purchase example
I get the error from Google Play:
Error
Error while retreiving information fro server. [DF-AA-20]
I am not sure if this is important:
I am at the very early stage of testing in Internal Testing (not
Alpha or Beta testing).
My developer account and my purchaser accounts are different
I have the purchaser account email in my testers group
A product ID is described in the documentation here. It is:
"Product ID - A unique, human readable ID for your product. Product IDs are also called SKUs in the Google Play Billing Library."
If you called your in app purchase "test1" then it is "test1".
-------- Edit
One problem (or good thing) with using 3rd party libraries (which is what the one is you link to is) rather than the Google Libraries is you don't get the official documentation. Google has produced some ok documentation on testing in app billing.
I'd go through all the steps on that page, and if it still doesn't work say the step where you failed. I suspect what is going wrong is you haven't yet published your app to the Play store. Before a real in-app product is purchased (as opposed to the test product names like 'android.test.purchased') The app must be published.
Don't worry if you don't want to publish your app to the world yet. You can use an Internal Testing Track. An Internal test track publish won't be visible to anyone except the test accounts you add to it. And it won't affect your position in things like top charts for newly released apps. It is specifically there to test things like purchases or Google Play license verification.
I'am working on community project for chess players and I use standard in app purchases provided by Google to get credit for functions to be used. I prefer however one big payment for one country (culture) made by some company or major local chess entity, personally dealing conditions, creating data source to fit my app, giving users everything within the culture for free and in return giving the sponsor place in various screens of my application.
I know 3rd party payment processors are not allowed for standard app use.
Breaking Google Play developer policy in this case or not?
Making in app purchase for this is just weird.
How to get money for such a product not breaking Google play rules?
There's a whole website by Google explaining the policies.
I don't work for Google's policy team, and I'm not a lawyer, but here would be my reading:
If you want a user to pay within your app, then use Google's methods. So if you want the person sponsoring the whole country to pay within the App, use Google's payment methods.
What you do as a company to strike sponsorship deals and take payment is up to you, if that payment happens outside the app.
But you should read that website above carefully for yourself, and of course Google Play has the final say.
I have payoneer account and i'd like to receive payments from app into this account.
Payments are not for physical goods. They are more like app content-unblockers.
Let's focus on Android and Google Play distribution case.
I suppose, payoneer is not designed for processing quick small payments, right?
I need these:
App should be able to set price according to misc factors.
Payments should be instant without credit card entering - i guess it called "Payments from Google Wallet". E.g. if i (app user) have google account and i have payment method in Google Play, then i do not need to enter my credit card number again.
Payments should be possible independently of user location (country)
So, can I use, say, Braintree to process payments with those requirements?
Will it violate any kind of Google Play policies (the fact, that i'm processing payments not through Google)?
The same questions about iOS
For Android : You can use third party payment seamless/non-seamless as long as their sdk supports Android platform. Google doesn't stop you from choosing any payment service.
For iOS : : It's million dollar question. Always refer to latest app store review guidelines https://developer.apple.com/app-store/review/guidelines/#purchasing-currencies
You can use third party payment gateway in iOS if you are selling physical goods/services outside of the app. For any in-app purchases you must use IAP.
For any in-app purchases if you use other purhasing mechanisms your app will be rejected.
Refer to section 3.1.1
If you want to unlock features or functionality within your app, (by way of example: subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use in-app purchase. Apps may not include buttons, external links, or other calls to action that direct customers to purchasing mechanisms other than IAP.