Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question SubscriptionManager .. handling subsequent subs rewards

Discussion in 'Unity IAP' started by stu_dious, Mar 2, 2022.

  1. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    Hi, when setting up a subscription purchase ...

    I've tagged the purchase as 'subscription' via Unity Economy Beta custom data when initializing UnityPurchasing. I can successfully buy and process the rewards for the initial purchase. I'm just unclear how future subscription rewards are handled (the test subs payments are happening every 5 minutes).

    I assume I have to poll the store via SubscriptionManager.getRemainingTime() or .getExpireDate() but am unsure about checking completion of payment or the number of payments since the app was last closed (i.e. launching app after 30 mins with the above 5 minute rollover)?

    Thanks, s
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate, "future subscription rewards". Is this on iOS or Android? Did you define your product on the respective dashboard as a subscription? For a subscription, you don't need to see completion of payment or number of payments, rather if the subscription is active or not. You typically check once, at the beginning of the game.
     
  3. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    Hi @JeffDUnity3D, thanks for your reply.

    I've added the subscription purchase to Google Play Stores Subscription list. I'm notified by email of payments occurring every 5 minutes (I realise these would normally be weekly or monthly).

    As a tester, with the subs payments happening frequently, several rewards would occur in 30 minutes, for example, so the app would need to apply the related rewards (e.g. 100 coins) several times.
    I'm assuming then it's a case of the app checking today's date against the subscription start date or last time logged in then processing that amount of rewards?

    Thanks, s
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate, "apply the related reward(s) several times". A subscription is purchased once, and the same reward is applied until the subscription expires. You don't award something different each time the subscription is auto-renewed.
     
  5. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    I'm probably misundertanding something. Say the subscription is $1 for 100 coins every month. Each month the player is charged $1 for 100 coins. The app determines if the subscription is active and when those coins are rewarded each month.
    By 'several' times I'm just meaning that if I hadn't run the app for a few months but had continued the subscription payments then I'd be due more than one months coins-reward when I did run the app.

    Hope that makes sense.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    So if the user didn't play the game for 3 months, when they launched the game, they get 300 coins? So they are rewarded for not playing the game? That is not typical for a subscription model. Typically coins are consumable since they would be consuming (using up) the coins. When they run out, they buy more. But on their own game time. Otherwise if the code above is working for you, by all means use it.
     
  7. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    Fair enough. As you say, down to the subscription model. I think because of the frequency of subs payment occurring when testing (emails about the subscription every 5 mins) that I should handle the edge case of it rolling over several times between plays. Anyway, thanks again for your feedback.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    So you're giving 100 coins every time it renews? I don't see that as an edge case. It will happen often.
     
  9. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    Wrong use of the phrase then. But yeah, if the player has paid a monthly subscription fee but not recouped the rewards for several months because they've not logged in, then when they finally do log in they should receive the rewards they've paid for. Having talked about it, I think we'd want to be fair to the player if they've paid for it.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    A subscription should not include consumable items as you suggest. You are using the wrong type of product. A subscription is not quantity based, but duration based. A subscription should only require a Boolean flag in your code. Does the user have access to levels 10-20, yes/no? Does the user wish to not see advertisements, yes/no? Does the user have access to premium content, yes/no? If the subscription is active = yes
     
  11. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    Ah ok, I can see now why there was some confusion about what I was suggesting then. Makes sense and simplifies things a lot :) I'd mentioned a coins reward as part of a subscription outside of this forum and hadn't been questioned on it, hence me running with it here, heh.
    Cheers