#Farbod
1 messages · Page 1 of 1 (latest)
Hi there!
Hey
Can you give a concrete example of what you are trying to achieve?
yeah let me write in details
this is the process:
- user visits my site and goes to the booking page
- books a tour which they can either pay in total or in installments (I'm creating subcriptionSchedules for installments, the first phase of the schedule will be paid immediately and the second phase has a number of iterations based on the number of installments the user selected)
- the user can see their bookings and can choose to pay the remaining installments for the tour immediately from my site.
I've tried updating the schedule and creating a new phase
So the user can at any time pay the remaining of the installements in one payment?
yeah they can choose a number of installments
and it should be paid in one payment
I'm creating a new price based on the number of installments the user selected
const installmentPrice = await stripe.prices.create({
unit_amount: number_of_installments * latestPhasePrice.unit_amount,
currency: 'usd',
recurring: {
interval: "month",
interval_count: 1,
usage_type: "licensed"
},
product_data: {
name: `interim installment payment for subscription: ${subscriptionID}`
},
});
When you create the instalment it makes sense to use a subscription schedule. But when the user ask to pay the remaining of what they own you at once, I don't think subscription schedule make sense.
Instead, compute how much the customer need to pay, create a PaymentIntent for this amount, and if it succeeds cancel the subscription.
but how can I track that the payment intent is for that specific subscription?
You can use metadata on the PaymentIntent or/and on the Subscription object.
The other option could be computing the new price, update the subscription with that new price, and then delete the subscription.
delete the subscription? I didn't quite get this one.
if I could charge the user immediately after changing the phases it would be great :))