djaodjin / djaodjin-saas

Django application for software-as-service and subscription businesses
Other
567 stars 126 forks source link

Generating Custom Bills | Question #136

Open karankapoor229 opened 6 years ago

karankapoor229 commented 6 years ago

I want to charge users extra per request if the usage is above the bundled usage in Subscription Plan for e.g if the plan has bundled 100 requests to a certain endpoint but the user ends up doing 105, so I want to charge the user for those extra 5 requests at the end of the billing period. I looked up the docs, but couldn't find a solution. Need some suggestions on how to do it?

smirolo commented 6 years ago

There is a UseCharge model which can associated to a Plan. In your case, you would create a subscription plan for 100 requests and a use charge per extra request. I will have to look through the code again to see if we either came around to add the use charge at the end of the billing period. Please give me a few days to check. Thank you.

smirolo commented 5 years ago

new_use_charge and record_use_charge are the backbone to implement extra use charges above a quota included in the subscription.

Revenue recognition for UseCharge was implemented in commit 64afb152.