I'm using Google Play IABv3 and want to be able to easily test what I do (not surprisingly). Since IABv3 all items are managed and it's up to the application to consume the items that it considers consumables.
I'm not sure what the expected work flow is with testing non-consumable products. To be able to test the purchase flow more than once you need to be able to remove the previous purchase. However, the purchase is intended to be non-consumable so we obviously don't want to add any code that consumes it (since it could accidentally slip through and remove real users purchases).
I would like some way of clearing a test users account from purchases, which I doubt is possible since there is no "real" test users.
What is the suggested way to do this?
You can use test product IDs instead of real items. Remember to use it only in debug builds.
https://developer.android.com/google/play/billing/billing_testing.html
android.test.purchased
When you make an In-app Billing request with
this product ID, Google Play responds as though you successfully
purchased an item. The response includes a JSON string, which contains
fake purchase information (for example, a fake order ID). In some
cases, the JSON string is signed and the response includes the
signature so you can test your signature verification implementation
using these responses.
android.test.canceled
When you make an In-app
Billing request with this product ID Google Play responds as though
the purchase was canceled. This can occur when an error is encountered
in the order process, such as an invalid credit card, or when you
cancel a user's order before it is charged.
android.test.refunded
When
you make an In-app Billing request with this product ID, Google Play
responds as though the purchase was refunded. Refunds cannot be
initiated through Google Play's in-app billing service. Refunds must
be initiated by you (the merchant). After you process a refund request
through your Google Wallet merchant account, a refund message is sent
to your application by Google Play. This occurs only when Google Play
gets notification from Google Wallet that a refund has been made. For
more information about refunds, see Handling IN_APP_NOTIFY messages
and In-app Billing Pricing.
android.test.item_unavailable
When you make an In-app Billing request with this product ID, Google Play
responds as though the item being purchased was not listed in your
application's product list.
Related
Google says you will receive empty orderId if purchase is test purchase. But we are getting proper orderId, so the question is how to check if the purchase made is a Test Purchase or Not. And why are getting orderId ?
I guess you're checking the json response and not the Google Play order receipt on email which includes an order number.
The JSON response is not supposed to include orderId if it was a test purchase. Have confirmed this few times. Make sure the account you're using to test purchase is included in the licence test accounts in the Google Play Developer Console > App Settings > Account details, then in the License Testing section.
Check here
When your In-app Billing implementation is ready, you can test
purchasing of your in-app SKUs in two ways:
Test purchases, which let your selected license-test users purchase
your in-app products without any resulting charges to the user. Test
purchases can be used in alpha/beta releases only.
Real purchases,
which let regular users make real purchases of your in-app products
with actual charges to the user’s payment instruments.
The problem gets solved on it own, I really didn't do any special but after sometime I start receiving empty orderId.
We've completed the implementation for Google Play Subscriptions v3 in our app and we are now testing with Alpha Builds on Play Store. Everything works perfectly, apart from the orderId, which is not returned as part of the Google Play API JSON response on the device. The token is returned as expected though. Is this happening because we are testing using Alpha Testing, or is it another issue? If so, shouldn't the orderId still be sent by the Google Play API as the token already is?
So apparently this is the expected behaviour when doing pre-release testing of Subscriptions with testing account licences, the Google Play API won't send out orderIds because no actual real life purchase is being made, so Google Wallet doesn't create any order. Which translates into no orderId being received by the app.
The official response from a Google Play Developer Support representative on the matter:
Currently, test subscriptions will not appear in your Google Wallet
Merchant Center because they are not actually assigned valid order
IDs. I'm sorry for the confusion.
To manage test subscriptions, you will instead need to use the
Developer API to refund, defer, cancel, or revoke test subscriptions.
To take any of these actions, you will simply need the app's package
name, the subscription ID, and the purchase token.
and when asked what not actually assigned valid order IDs means,
As per your concern, since it's test purchase, there won't be any
order ID. The order ID will however only exists when you move to
production.
In my game I have InApp Purchases. I want to test my game before publishing, so I uploaded it to alpha. I would love to test it on my phone, but google refuse, saying a developer can't buy his own products. Google also refuse to allow emulators to purshase items.
Yesterday I added a google account to my phone, and added it to the list of people allowed to download my app (Gmail accounts with testing access).
My problem is that I can't access my game (We're sorry, the requested URL was not found on this server). My game is available (I checked it from another phone and its good). I simply can't access it from my test account.
What can I do? Should I do something, or I will not be able to test my game on my phone no matter what?
Here is the android developer help for testing in-app purchases. The second account you added should be able to access the game shortly. In my experience, it usually takes up to about 24 hours to access alpha/beta testing once a user has been added.
Here's some specific stuff from that post:
Test Purchases (In-app Billing Sandbox)
Test purchases offer a secure, convenient way to enable larger-scale testing of your In-app Billing implementation during development or in preparation for launch. They let authorized user accounts make purchases of your in-app products through Google Play without incurring any actual charges to the user accounts.
Once authorized for testing access, those users can make purchases without being charged. Test purchases are real orders and Google Play processes them in the same way as other orders. When purchases are complete, Google Play prevents the orders from going to financial processing, ensuring that there are no actual charges to user accounts, and automatically canceling the completed orders after 14 days.
We recommend that you first test your In-app Billing implementation using static responses from Google Play. This enables you to verify that your application is handling the primary Google Play responses correctly and that your application is able to verify signatures correctly. You can do this even if the app hasn't been published yet.
To test your implementation with static responses, you make an In-app Billing request using a special item that has a reserved product ID. Each reserved product ID returns a specific static response from Google Play. No money is transferred when you make In-app Billing requests with the reserved product IDs. Also, you cannot specify the form of payment when you make a billing request with a reserved product ID.
I am doing the static testing using the 'android.test. ...' purchase items.
'Purchased' seems to work OK.'Cancelled' and 'refunded' always produce a null purchase response when it gets to the listener. Is this what they are supposed to do?
Other response information tracing back through the calls seems OK.
According to my knowledge:
android.test.cancelled and android.test.refunds both are called when if user has been cancel the purchase or subscription or if user has been refunded by the google wallet. so purchase was cancel for both the cases so that you will get response as a null.
android.test.canceled
When you make an In-app Billing request with this product ID Google
Play responds as though the purchase was canceled. This can occur when
an error is encountered in the order process, such as an invalid
credit card, or when you cancel a user's order before it is charged.
android.test.refunded
When you make an In-app Billing request with this product ID, Google
Play responds as though the purchase was refunded. Refunds cannot be
initiated through Google Play's in-app billing service. Refunds must
be initiated by you (the merchant). After you process a refund request
through your Google Wallet merchant account, a refund message is sent
to your application by Google Play. This occurs only when Google Play
gets notification from Google Wallet that a refund has been made. For
more information about refunds, see Handling IN_APP_NOTIFY messages
and In-app Billing Pricing.
check this link for more information.
Hope it will help you.
I need to verify how my in-app billing works.
Would like to test that with test accounts.
If I buy my in-app item with usage of test account, do I need to pay for it?
Ok, I've tested that - even if test account is used, you have to buy your own item.
Will check later on if it is possible to reverse amount paid (and if google 30% charge would be applied).
Upd. reversal is possible, the whole amount is reversed.
You can reverse your transaction by using
There are four reserved product IDs for testing static in-app billing responses:
http://developer.android.com/guide/market/billing/billing_testing.html
android.test.purchased
When you make an in-app billing request with this product ID, Android Market responds as though you successfully purchased an item. The response includes a JSON string, which contains fake purchase information (for example, a fake order ID). In some cases, the JSON string is signed and the response includes the signature so you can test your signature verification implementation using these responses.
android.test.canceled
When you make an in-app billing request with this product ID Android Market responds as though the purchase was canceled. This can occur when an error is encountered in the order process, such as an invalid credit card, or when you cancel a user's order before it is charged.
android.test.refunded
When you make an in-app billing request with this product ID, Android Market responds as though the purchase was refunded. Refunds cannot be initiated through Android Market's in-app billing service. Refunds must be initiated by you (the merchant). After you process a refund request through your Google Checkout account, a refund message is sent to your application by Android Market. This occurs only when Android Market gets notification from Google Checkout that a refund has been made. For more information about refunds, see Handling IN_APP_NOTIFY messages and In-app Billing Pricing.
android.test.item_unavailable
When you make an in-app billing request with this product ID, Android Market responds as though the item being purchased was not listed in your application's product list.
It seems that Google has improved testability of in-app purchases so that you can test purchases with your products (not just the four reserved product ids) without charging your credit card:
When your In-app Billing implementation is ready, you can test purchasing of your in-app SKUs in two ways:
Test purchases, which let your selected license test users purchase your in-app products before the app is published, but without any resulting charges to the user, and
...
http://developer.android.com/google/play/billing/billing_testing.html#testing-purchases