Payment Flows with Usage Based Pricing

https://whimsical.com/payment-flow-9GuytUESMScG2ZUg5vVYnj

Problem to Solve

The next feature to release needs to be the pre-pay, credit, and post-service billing process.

The nature of the service is that I consume processing with every Compaction.

While I can and am working on reducing those costs, in the short term, I need to cover the hard costs of running multiple AI services.

This means I need a form of pre-payment to cover the use of those services before the services are rendered.

I want users to try the service as soon as possible, so this means pre-paying the minimum amount initially.

Here are a few scenarios:

  1. User is using for the first time and wants to try out a Compaction. They pre-pay to cover the typical costs -- perhaps $5.
    1. Charge the customer using Stripe
    2. Upon completion, issue a credit in Togai.
    3. Associate the
      1. Note: this means that the workflow needs to be kicked off only as a "webhook" from Togai when a credit has hit its system and been recognized (which I assume will only occur if Stripe recognizes the purchase).
      2. The webhook, then, must know the "state" since currently the Compaction process needs some kind of "state" for it to run
        1. Or...we need a way for the Togai webhook, if it is stateless, to then trigger a queue, which could be possible....need to think about this....
    4. When the customer wants to do another video, what is their option at that point?
      1. There is another check if the credit is <$5....which it will be.
      2. Then give the customer an option to pre-pay at another amount, $20, $50, or something....
      3. OR
      4. It's an agreement that they will be billed and invoiced after ever Compaction, with an average of about $2 each?
    5. I guess I should come up with a pricing model of how much in advance is the credit? I have definitely seen services which use a pure up front credit model versus just charging in arrears, and I think I want to go that way.
  2. When credits run out, then ask again....
    1. This might be the best user experience, because the User will be aware of their rate of consumption when they have consumed the credits (but how far?)
  3. How do we know what the right "reserve" should be?
    1. Most jobs we know seem to average around $2....so is keeping a $5 reserve enough?
    2. What happens if there's a $5 reserve.....and the job is say $6?
Question: Is the following true: the Customer **must** be *first* created in Stripe, and Togai flows with create the customer in Togai from Stripe?

The other way will not work: creating the customer and accounts first in Togai ... there is no flow from Togai to customer creation in Stripe.

This is confusing given this flow:

Between the two, which is preferable?

Payment Logic

https://whimsical.com/payment-logic-DaxX2R28NxaXqgS5vJrpfE