There are some type of events that you need to have in your backend. Use Liquid to update automatically every time something you need to know occurs.
When you use Liquid's Formulas, you'll select the audience, the action and the time.
WebHook - Notify backend and update user
Activity based on Purchase Credits
Select “All users” in the Audience screen.
Select WebHook as the action and past the WebHook url to it.
Make the action Activity-based and select the option that is triggered by the “buy_product” event.