I have a question about how RevenueCat outputs the price fields (price, price_in_purchased_currency) with actions that have proration. I can think of two scenarios where proration comes into effect:
- Android upgrades with IMMEDIATE_WITH_TIME_PRORATION
- iOS upgrades
When these events occur we receive a webhook with details about the change. Does this webhook contain the full price of the new plan, or the prorated price? I am also wondering about the transactions that get exported into S3, but I’m guessing that answer is the same as the webhooks.
As an example, say a users is paying $50 per month for a subscription. Half way through the billing period they upgrade to a subscription that is $100 per month. Is the `price` in the webhook going to be $75 (assuming the renewal date remains the same) or $100 (if it reports the full price of the new plan)? I’ve tried to test this out myself in Sandbox, but with the super quick renewal periods, it’s hard to say for certain what is going on.
A similar question I suppose, is related to refunds issued through RevenueCat. This perhaps is more specific to each store, but are refunds prorated? Again, while testing in the Sandbox I don’t see real invoices, so I can’t tell for sure.
Any info would be appreciated, thanks.
Best answer by ryanView original
The `price` attribute in the webhooks (and S3 exports) will be RevenueCat’s best estimate of the price the customer was charged for the transaction - so this would be the prorated price if applicable.
If you summed the price field from all of the webhook events, that’s how you can compute the total $$ that customer has spent (this is how the RevenueCat Customer Pages work too).
Refunds are not prorated - the full transaction amount is refunded. This also sets the expiration date back to the purchase date on iOS. In webhooks the `price` will be a negative value for refunds.
There’s some differences in how refunds are detected between iOS and Android, more info in the docs here: https://docs.revenuecat.com/docs/managing-subscriptions#refund-a-subscription