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.
Related
Per doc
Once you've verified the purchase, your app is ready to grant entitlement to the user. After granting entitlement, your app must then acknowledge the purchase. This acknowledgement communicates to Google Play that you have granted entitlement for the purchase.
Note: If you do not acknowledge a purchase within three days, the user automatically receives a refund, and Google Play revokes the purchase.
We know after Google Play Billing Library 3.0, we must acknowledge the purchase within 3 days. Otherwise, the purchase will be automatically refunded by google play.
The acknowledge logic is done on our server-side, we want to double-check the acknowledge logic through fetching the refunded purchase due to the acknowledgment issue. For example, our server does acknowledge one purchase successfully. Does the refund of this purchase still happen? One solution is to retrieve the refunded purchase data from google play and check whether the acknowledgment is done on our server-side.
However, per google play support guys, we could Not fetch those refunded purchases due to the acknowledgement issues through Voided Purchase.
Is there any way to verify the acknowledgement logic in google play in-app purchase? Or anything am I missing?
I trying to test Android In-App Billing V3 to make subscription purchases.
Im aware of the following:
"Test subscription purchases recur daily, regardless of the product's subscription period."
but I noticed the following behavior:
A user buys a monthly subscription through google play, the client passes the information to the server. On the server side, I make an API call to google to get more info about the subscription.
I go to the Google play dashboard and cancel the subscription. (it changes from renewing on X to expire on X).
I buy the same subscription again but I have the following behavior:
Purchase token is the same as in #1. My assumption that the purchase
token will be different.
autoRenewing is still set to false (even
though google play dashboard shows "will renew on x").
expiryMills still shows the original expiration which is in the past (I resubscribed a couple of days later so I would expect the expiryMills to be updated)
Im not sure if this is the correct beahvior or not ...
I would expect the following: If im in within the period, so after the user cancels and then resubscribes, the autoRenewing will "true", and if im after the period, I will get a new purchase token so that the information I get from google api will match the google play dashboard.
Ofir
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.
I'm trying to implement in-app subscription in my application. Everything seems to work ok, except for refund. I made a test account, and bought test subscription. In response got "purchaseState" : 0 (purchased). I immediately issued a refund through a Merchant Console, in response I got same "purchaseState" : 0.
Shouldn't I be notified of refund, so i can cancel subscription on my end? How do i handle refunds for subscriptions? I understand cancellations - state will be changed after expiration date. But refunds..
Refunds are not supported for subscriptions. I recently implemented subscriptions in our Android app and had some of the same questions and saw the same results but confirmed that 'refund' state is never sent for a subscription. Mostly because Google does not give you a refund (unlike in-app billing).
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