For new Patron’s you can simply keep track of the Reward resource on their Pledge, i.e every successful billing cycle you check which Reward they have and then award them the appropriate points – you would keep an association between Reward ID and level in your local database.
Edit: I forgot to mention, you’ll need to account for campaigns which charge upfront, as in an is_charged_immediately
campaign the patron is immediately charged the difference between their current pledge and their new pledge or in the case of decreasing their pledge they are charged only the difference next month (source). You could do this with something like, “if campaign is_charged_immediately and reward_id is not equal to the previous reward_id, recalculate points considering the previous month to have been at the new reward level”.
You cannot access historical data at the moment beyond total_historical_amount_cents
, therefore, if your system was set up after a campaign had started you wouldn’t be able to determine an existing patron’s points exactly but you could determine it reasonably well based on knowledge of the pledge start date, the current amount and our understanding of average user behaviour.
For example:
- Pledge started 6 months ago
-
total_historical_amount_cents
is 4000 - The campaign has 2 reward levels, $5 and $10
- The current pledge
amount_cents
is 1000
From this information, we can determine that they probably upgraded from the $5 to $10 pledge 2 months ago, and award the appropriate 6000 points (4 x 500, 2 x 2000).
A Patreon employee stated that they intend to expose more payment information, that’s on their roadmap for the next quarter, so there’s hope it’ll get easier in future.