Restore In-App Purchases node does not work

The “Restore In-App Purchases” node does not work.

Neither On Success or On Failure execute on mobile.

http://puu.sh/linvH/3becff059e.png

Hey Rett,

After thoroughly testing this and searching AnswerHub and the Forums, I came across a couple links for you. First, the Jira is reported as UE-7474 and it hasn’t been resolved yet, it’s still on our to do list. It’s scheduled as a major bug though. Here is an AnswerHub post that has detailed information about the in-app purchasing nodes. Here is the Forum post that has further details as well.

Thanks!

Actually, we have verified Restoring an In-App purchase works as of a couple of days ago in 4.10. Are you certain you enabled In-App purchasing in your project settings? Does your mobile provision have In-App purchasing enabled? Have you set the OnlineSubsystemClass to be the OnlineSubsystemIOS? Any one of these things will cause the entire system to not be enabled at all which would look like the restore is not working when in fact, the entire system is off.

-Pete

The 4.10 engine source indicates that it is still not supported:
source:
C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Online\Android\OnlineSubsystemGooglePlay\Private\OnlineStoreInterfaceGooglePlay.h

Code:
class FOnlineStoreGooglePlay : public IOnlineStore
{
public:
/** C-tor /
FOnlineStoreGooglePlay(FOnlineSubsystemGooglePlay
InSubsystem);
/** Destructor */
virtual ~FOnlineStoreGooglePlay();

// Begin IOnlineStore 
virtual bool QueryForAvailablePurchases(const TArray<FString>& ProductIDs, FOnlineProductInformationReadRef& InReadObject) override;
virtual bool BeginPurchase(const FInAppPurchaseProductRequest& ProductRequest, FOnlineInAppPurchaseTransactionRef& InReadObject) override;
virtual bool IsAllowedToMakePurchases() override;
virtual bool RestorePurchases(FOnlineInAppPurchaseRestoreReadRef& InReadObject) override
{
	// Not Yet Implemented
	return false;
}
// End IOnlineStore 

void ProcessQueryAvailablePurchasesResults(bool bInSuccessful, const TArray<FInAppPurchaseProductInfo>& AvailablePurchases);
void ProcessPurchaseResult(bool bInSuccessful, const FString& InProductId, const FString& InReceiptData);

I forgot to add that this is for Android that RestoreP urchases doesn’t work. For IOS the integration with GameCenter seems to be much more complete… but I haven’t tried it yet.

Thank you for all of this additional information. I have reached out to our Android Developers to see what the issue may be. We will contact you back once we have additional information.

Thanks!

I just heard from our Android Developer. This is currently being looked into and we’re hoping to have this issue addressed as soon as possible. Please check the release notes as new versions of the engine are released.

Thanks. :slight_smile:

Hi Samantha,

Hi, Just to share with everyone in the UE4 community as I know a lot of people have had issues with Android in App Purchases. We are currently using UE4 version 4.9.2, We found that there were several problems with the current implementation of Android In App Purchases:

  1. The Purchases automatically call the consume api even when it is just querying the inventory. It even automatically calls consume after purchasing is successful. This is of course not a good thing for us because we have no consumable purchases. This causes subsequent purchase queries to return zero products owned from the google store.
  2. The query purchase/inventory API does not return all products owned by the current user. You need to pass in your product codes and then query the products individually for existing purchases one at a time.

So. to accomodate our requirements, I have made the following fixes and now our in app purchases and restoring functions are now working properly. If anyone needs to call the consume api when your in app purchases are consumed during gameplay, they will need to make some modifications to uncomment and implement the consume functions at the desired point as we do not use them at all.

C:\Program Files\Epic Games\4.9\Engine\Build\Android\Java\src\com\epicgames\ue4\GooglePlayStoreHelper.java

  • Remove all consume functions, fix IAP Query Inventory and use it for Restoring Purchases by Querying what is owned by the user (no need to pass in the product ids) and
    returning just the product ids previously purchased. Becuase query purchases only returns three arrays, The currency code and the microprice value is returned as a concatenated string in the prices array and then parsed in a blueprint function

C:\Program Files\Epic Games\4.9\Engine\Build\Android\Java\src\com\android\vending\billing\util\Inventory.java

  • Make public methods to getAllSkuDetails and GetAllPurchases - so Inventory Query will work and return products owned by the user.

C:\Program Files\Epic Games\4.9\Engine\Build\Android\Java\src\com\android\vending\billing\util\SkuDetails.java

  • Add mPriceAmountMicros and mPriceCurrencyCode returned from Google API which is not in the current version.

Attached are the modifications we’ve made to support our requirements.

Hopefully the fixes therein can be incorporated in the next version of UE4 so we don’t have to keep track of these changes.
link text
link text
link text