'Add an offer to an already existing user subscription in my Android app (Google Play IAP)

Google Play IAP allows the developer to set up offers in the app subscription with trials and discounts.

If the offer is a developer determined offer the developer can add logic to the backend or frontend to allow a user to subscribe with that offer depending on some condition.

This works great, but how about applying an offer to an already existing subscription?

Imagine the following scenario:

I have a referral system in my app, if the user invites someone to the app and that person subscribes to a plan, both users will receive a 20% discount.

To do that for the new user is easy, I just add that offer during that user subscription.

But for the old user, I'm not sure how to do that, since that user already has a subscription going, I can't find any API here that would allow me to apply this offer to his existing subscription.

Is that possible somehow? Or is there some workaround to make a referral system like this work with Google Play IAP subscriptions?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source