Search code examples
phplaravellaravel-4stripe-paymentslaravel-cashier

Laravel - Stripe Subscription based on Quantity / variable subscription amount


I have implemented Stripe in a Laravel project. I want to charge the customers monthly but each of them will have to pay different amount. I'm sending them an invoice separately through another system, they will have to enter their invoice number, amount and pay on my website.

Now to charge customers a variable amount, I've come across a solution here: https://support.stripe.com/questions/how-can-i-create-plans-that-dont-have-a-fixed-price

I have form where a customer will enter his invoice number, other details and the amount he wants to pay. Now how can I use this information in stripe form and create a stripe customer like this? I'm not able to get this to work.


Solution

  • Ok, so I've worked around a solution for this problem. Instead of using Stripe's Quantity or QuantityIncrement() what I've did is created a separate plan for each customer.

    Now Laravel Cashier doesn't allow us to create stripe plan programmatically. However, this solution has helped me do this. Although I had to make few changes to get this working in Laravel but I've got this working finally after playing around.