How to implement a credits system to track usage across multiple different features.
default
product so it is
automatically assigned to any new customers.allowed: true
as they have overage pricing enabled.
small-model-tokens
,
medium-model-tokens
, large-model-tokens
) here—not the credit system.check
endpoint again (as we should before using any of the models), we can see that the balance
and allowance
fields have been updated. Since allowed
is false
, we should prompt the user to upgrade.
attach
route to get a Stripe Checkout URL for them to make a payment.
checkout_url
to complete their purchase. Our checkout URL should look like this:
check
route will always return allowed: true
for our pro users. Let’s use up some more credits to see what happens: