Hi, renojim. Thank you for your reply.
I’m still mulling this over. If someone out there is attempting to implement Roku pay, please don’t take the below as advice on how to implement it. I’m just thinking out loud.
One thing I’ve done is to implement Roku Push notifications.
https://developer.roku.com/docs/developer-program/roku-pay/implementation/push-notifications.md
Roku sends you quite a bit of info about subscription status and describes what you should do in response (it doesn’t mention the validate transaction API).
This is useful if you offer the same subscription on other platforms, e.g. FireTV, and wish to allow users who have purchased your subscription on Roku access to the same features on other platforms.
Regarding the validate-transaction API, I’m still not sure where it fits in.
In the “Managing subscription recovery” section on the page linked below (you have to scroll down), there’s quite a bit of detail about using the validate-transaction API server side.
https://developer.roku.com/docs/developer-program/roku-pay/implementation/roku-web-service.md#validate-transaction
The idea is that you run a cron job nightly making requests to the validate transaction API for subscriptions in recovery “spread out over an approximately 6-hour period” (Roku is oddly specific about that, guess they don’t want you spamming their service) to check the statuses. It describes what qualifies a subscription as being in recovery.
It says:
“If the isEntitled flag is “false”, Roku has completed the payment retry cycle and canceled the subscription. Call the cancel subscription API and put the account in an “unsubscribed” state in your entitlement service so it can stop calling the validate transaction API for that subscription.”
‘Call the cancel subscription API’
Is that strictly necessary? For a subscription that has been cancelled already, do we have to call the API to finalize that cancellation?
Anyway, I’m wondering if push notifications and getAllPurchases are enough:
- Server side, you get the info you need through push notifications.
- App side, you get the info you need from getAllPurchases.
I’m wondering on the app side of things, if you need to check with getAllPurchases from time to time. Say someone loads your app and leaves it running for days on end. Maybe a timer set to ping every 24 hours to check would be sufficient in case their subscription status changed.
At any rate, I’m still working through this. Thanks for any replies.