Skip to content

gem usage_credits#208

Draft
yshmarov wants to merge 101 commits into
mainfrom
add-gem-usage_credits
Draft

gem usage_credits#208
yshmarov wants to merge 101 commits into
mainfrom
add-gem-usage_credits

Conversation

@yshmarov
Copy link
Copy Markdown
Owner

@yshmarov yshmarov commented Mar 28, 2025

https://docs.stripe.com/testing


consumption-based pricing / usage-based pricing model / charging users for API requests

https://github.com/rameerez/usage_credits/


Default gem features that require fixing:

TOP PRIORITY



Auto refill todo:

  • auto top-up settings: wallet.enabled_auto_top_ups:boolean, wallet.auto_top_up_credit_pack
  • config.auto_top_up_threshold = 500 # top up when balance falls below 500 credits
  • override operation to try to automatic top-up
  • add spending limits?

@yshmarov
Copy link
Copy Markdown
Owner Author

credits - default gem implementation
Screenshot 2025-04-01 at 00 21 41
refills - closer to serper
Screenshot 2025-04-01 at 00 21 52
serper (benchmark)
Screenshot 2025-04-01 at 00 22 26

@yshmarov yshmarov self-assigned this Apr 1, 2025
# Handle low credit balance alerts – Useful to sell booster credit packs, for example
config.on_low_balance do |organization|
if organization.wallet.can_auto_refill?
ChargePaymentMethodJob.perform_now(organization, organization.wallet.auto_refill_credit_pack)
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most important line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants