I am trying to implement in-app billing into my application, I have the buying part working right but how do I take care of issuing a refund?
Under the Testing In-App Billing
section it says that you have to watch for IN_APP_NOTIFY
but when you click about that it takes you to v2
of the api where you have to register a broadcast receiver. In v3
however it gives no information on what to do or if even IN_APP_NOTIFY
is still used the same or supported.
The sample app does not handle refunds either so how am I suppose to handle refunds in v3
?
Sign in to reportaproblem.apple.com. Tap or click "I'd like to," then choose "Request a refund." Choose the reason why you want a refund, then choose Next. Choose the app, subscription, or other item, then choose Submit.
You are supposed to handle them the same way as in v2: when a user requests a refund, cancel or refund the order via the Checkout console. Then the app should check the status of the purchase when starting up, etc. and do the right thing (typically allow access for refunded purchases, and deny for cancelled ones). Unfortunately the provided sample doesn't bother doing this, so you will have to add it yourself. Even more unfortunate is the fact that due to local caching and/or bugs on the server side, purchases will stay in the purchased state long after you cancel or refund them. There is not much you can do about it though ATM.
Assuming you are using the Trivial Drive sample, you might want to add something like this to your app:
Purchase purchase = inventory.getPurchase(product);
Log.d(TAG, "Purchase state: " + purchase.getPurchaseState());
// 0 (purchased), 1 (canceled), or 2 (refunded).
if (purchase.getPurchaseState() == 0
|| purchase.getPurchaseState() == 2) {
showPremiumVersion();
} else {
showFreeVersion();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With