Forum Discussion

ContraryMotion's avatar
ContraryMotion
Binge Watcher
28 days ago

DoRecovery API

I'm trying to test the DoRecovery API. I've discovered that it can only be tested by creating a beta app, i.e. it can't be tested by sideloading the app.

This was discussed here:

https://community.roku.com/discussions/developer/dorecovery-api-always-returns-recoverystatus-1-enhanced-subscription-recovery/1001978

This is a serious impediment to testing the app. With each change, you have to package the app and upload it to your beta app. Then wait for the change to propagate to your Roku device so you can test it. You don't get the usual info through the debug console.

Does anyone know a way around this? And if not, is there a faster way to see the changes made to a beta app on your Roku device? It's taking way too long between updates for my changes to take effect.

6 Replies

  • Rather than start a new thread, I'll ask my next DoRecovery API question here.

    After the update payment method dialog appears and I've entered my credit card info, I get a "Please wait..." spinner that lasts a long time. Then I get another dialog that displays this message:

    "Your payment information is updated. It may take a few minutes to process renewals."

    The DoRecovery API then returns with a status code of 2, which Roku describes as:

    "One or more subscriptions are still in recovery."

    This leaves my app in an awkward position. It still sees the subscription as in recovery and doesn't have a way of knowing when the renewal completes.

    Should I just start polling getAllPurchases for an update? Is there a callback mechanism I'm missing that lets you know when the renewal is complete?

    Channel Store

     

    • ContraryMotion's avatar
      ContraryMotion
      Binge Watcher

      I settled on this approach:

      If the DoRecovery API returns with a status code of 2, the subscription in question is still in recovery, I set up a timer and begin polling getAllPurchases so that my app can know when/if the subscription comes out of recovery.

      I use exponential back-off with the timer to keep from spamming Roku's API servers.

      I have push-notifications set up with my back-end servers, but that only helps if I poll my servers instead of Roku's getAllPurchases, and there are security concerns with that; how do I authenticate the requests to make sure the right account is asking about a transaction they own?

      I can do that by forcing the user to log in with their app account, i.e. non-Roku account, but instead of doing that I opted for polling getAllPurchases.

      My workflow is:

      • At app startup, getAllPurchases is pinged
      • If there are any subscriptions in recovery, I call the DoRecovery API at the appropriate place so that they are prompted to update their payment info.
      • Upon the DoRecovery API completing, if the user didn't cancel the payment info dialog, I check the return status:
        • If it's 1, we're all good (payment info was updated and processed).
        • If it's 2, we assume they entered the payment info but that it hasn't had time to be processed (subscriptions are still in recovery).
          • Begin polling getAllPurchases as described above (with exponential back-off).
          • When the subscription in question comes out of recovery, turn off timer.
        • If it's 3, the user cancelled the subscription. Update the internal logic of the app accordingly.

      At any rate, this is the approach I've settled on for now. I'm still testing and have not submitted the app for certification, so we'll see if this passes muster with Roku then.

       

      • renojim's avatar
        renojim
        Community Streaming Expert

        Let us know how it goes.  I have to wonder if you're overthinking it.  My approach was to just look for a return status of 1 with the thinking that it's either recovered or it isn't.  If you're just looking to pass certification, I doubt the logic in the static analysis is sophisticated enough to check what you do with each status.

  • renojim's avatar
    renojim
    Community Streaming Expert

    Check for updates under Settings->System->Software update and it should download the update immediately.

    I don't know why a beta app is required, but it is a pain in the neck.  I've become used to them coming from Roku.

    • ContraryMotion's avatar
      ContraryMotion
      Binge Watcher

      Hi renojim. Thanks for your response.

      I'm still experiencing quite a bit of latency even after forcing an update as you described. I'll keep at it; there's probably something I'm missing. The updates do appear, but it's still taking awhile.