#victoria.fabris - installments
1 messages · Page 1 of 1 (latest)
im my application the user can choose how many installments they want, for example a purchase of $400 they can choose to make in 2 installments of $200 each
in that way, in receiving from the front end the user input for the number of installments
i already saw that stripe dont make the calculations automatically, so i was thinking in receiving this number of installments, and do the calculations of the price of each installment on my own, and then send this value inside stripe.SubscriptionSchedule.create()
but i dont know if im following the right path
Ok. I believe you can actually do this with just a plain subscription to simplify things. You could define the price on the fly. For example, if the cost is $400 and the user chooses 2 installments, you could create the subscription with a price per month of $200: https://stripe.com/docs/api/subscriptions/create#create_subscription-items-price_data-unit_amount and a cancel at date of 2 months into the future: https://stripe.com/docs/api/subscriptions/create#create_subscription-cancel_at
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, so i would just use stripe.Subscription.create( ), right? i still need to create a price and product object? with stripe.Product.create() and stripe.Price.create()
i dont understand where will i use these objects
No, if you define the price per month on the fly, as I linked above, you actually won't need to create a price object (since the per month charge will be different depending on how many installments the customer chose). However, you will still need to pass the product id: https://stripe.com/docs/api/subscriptions/create#create_subscription-items-price_data-product
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
great! that helped a lot!
another question: will i need to make a stripe.PaymentIntent.create() before the stripe.Subscription.create()? or this dont make sense? 🤔
Nah creating a payment intent would be for a one-off payment. Our subscriptions generate paymentintents under the hood though. I highly recommend reading this doc page: https://stripe.com/docs/billing/subscriptions/overview
i undestand, thank you a lot!
No problem!