Solved

iOS code redemption issues in flutter

  • 1 January 2022
  • 6 replies
  • 46 views

Badge

Hi all,

Im trying to get iOS Code Redemption working in flutter and having some issues.

So as per the doc (not flutter specific, so following the API doc mixed with the swift example), and I go ahead and call: 

await Purchases.presentCodeRedemptionSheet();

And then….. nothing happens? Is there anything else that needs to be done in the code after the sheet is dismissed to detect that a purchase has been made via the code redemption sheet? It’s really hard to test as this as it seems as though it cant be tested in a simulator or in debug mode on a real device - so I’m doing it ‘live’ and not getting any really good logging.

The “Codes” are attached to an App Store IAP that I do have configured in revenuecat / has an entitlement….

I’ve tried to re-initialise the purchaserinfo object & check for entitlements again and its still not triggering in the way it should if an entitlement is detected. 

Running purchases_flutter 3.1.0 on flutter 2.0.5

Anyone have any ideas? 


 

icon

Best answer by sundeep 8 January 2022, 02:22

View original

6 replies

Userlevel 2
Badge +6

Hi @Luke Bellamy,

Yeah, there’s no convenient callback with that function that lets you know when it’s been dismissed, or what occurred. But implementing a PurchaserInfo listener should help you detect that the purchase was made: https://docs.revenuecat.com/docs/purchaserinfo#listening-for-purchaser-info-updates

Badge

Hi Sundeep,

Unfortunately I’m still not having much luck. I’ve added a purchaserinfo listener as you’ve suggested, but after the promo code workflow has gone through, there does not seem to be a callback at all. Even then, if the user closes and opens the app again RC when its initialising should pick up the purchase anyway correct? 

Even in the RC console when i look at my test user, it’s showing them as not having any entitlements? I’m really stumped here 

Userlevel 2
Badge +6

Hi @Luke Bellamy,

Have you tried hitting Restore Purchases after the flow to just check if the purchase is recorded at all? Also, are you trying this in sandbox or production?

Badge

Hi Sundeep,

This is production - I don’t think there’s a way of testing this in sandbox is there? 

Yep. I’ve tried a restore purchase and that ALSO doesn’t appear to be working. 

I’m really not sure what to try next. Any ideas or suggestions would be greatly appreciated….

Regards,

Luke
 

Userlevel 2
Badge +6

@Luke Bellamy No, I don’t believe you can test well in sandbox either - was just checking to see if that was the cause here. To my knowledge you are doing the right things, but I do have some follow-up questions:

  • I’m assuming you were testing this with your own account - have you looked at your subscriptions in your settings (or on the App Store) to confirm whether the subscription is active? 
  • Did any error messages pop up in the UI when you tried to redeem the code?
  • Did you have any active subscriptions when you were trying to redeem the code? 

If you'd like, we could make a ticket for this so I can take a look at the user and see if our logs shed any light.

Badge

Hi Sundeep,

Thanks for the response. Please see the answers to your questions in red:
 

  • I’m assuming you were testing this with your own account - have you looked at your subscriptions in your settings (or on the App Store) to confirm whether the subscription is active? 
    • Yep. Subscription is present in my subscriptions list in the app store. 
  • Did any error messages pop up in the UI when you tried to redeem the code?
    • No error messages appeared when I tried to redeem the code. It worked (and purchased a subscription...). 
  • Did you have any active subscriptions when you were trying to redeem the code? 
    • There were no active subscriptions (to this app anyway)

Yeah, I think it might be worth raising a ticket, if that gives you the ability to look @ logs (which hopefully will shine some light on the issue!). Do you want me to go ahead and do that, or are you able to raise one on my behalf? 

Regards,

Luke

Reply