cancel
Showing results for 
Search instead for 
Did you mean: 

GetViewerPurchases returns PurchaseList with 0 count

LemeSherry
Explorer

I have a subscription setup and its checkoutflow seems to be working perfectly as expected, but when i try to fetch the viewers purchases at the start of the game it returns PurchaseList with the count of 0 although they certainly seemed to have the purchased product (in this case its a re-accuring monthly/yearly subscription) so how can I fix that issue? Any help in this regard is highly appreciated

Note: This issue was occuring when tested production build with real users. The SKU ids and everything else is checked properly.

Here is the example implementation:

private void StartOfTheGame() {
IAP.GetViewerPurchases().OnComplete( HandlePurchaseListResponse );
}
private void HandlePurchaseListResponse( Message<PurchaseList> msg ) {
if( msg.IsError ) {
LogAssertion( $"Error: {msg}" );
return;
}

hasSubscription = false;

Log( $"purchase list count: {msg.GetPurchaseList().Count}" ); // This returns 0 as a result hence the for loop doesn't even start although I have made sure that the user do have the product purchased

if( msg.GetPurchaseList().Count <= 0 ) {

_currentAttempts++;
if( _currentAttempts >= _initializationMaxAttempts ) return;

IAP.GetViewerPurchasesDurableCache().OnComplete( HandlePurchaseListResponse );
Log( $"No purchases found, tyring to get cache purchases" );
return;
}

foreach( Purchase p in msg.GetPurchaseList() ) {

LogPurchasedProductDetails( p );

if( p.Sku is ProSubscriptionYearlySKU or ProSubscriptionSixMonthSKU or ProSubscriptionMonthlySKU ) {
SetSubscriptionAsActive( p );
}
}

if( !hasSubscription ) {

Log( "Pro subscription not active." );
}
}




4 REPLIES 4

LemeSherry
Explorer

No one has anything on this?

 

LemeSherry
Explorer

Why the forums here are so dead... hello??? Anyone????????????????????????????????

strplay
Honored Guest

@LemeSherry I have the same problem.
Please let me know if you have solved it.

surely @strplay, although it has been more then 3 months since I reported this issue, I also had a talk with technical team as well but everyone seems to be answer the same exact answers which at the moment of writing this doesn't work for me, and everything else is setup correctly from my side as well, but anyways lets see how it goes.