#andrea-skuola-subscriptions

1 messages ยท Page 1 of 1 (latest)

azure tree
#

๐Ÿ‘‹ happy to help

#

are all installments the same?

charred carbon
#

yes

azure tree
charred carbon
#

I did this but there was a problem: if the subscription is created today, as the payment is monthly, it will renew on Aug 7, so cancel_at I set it to Aug 7 +7 days to make sure that the subscription does not expire before the last installment is paid (I had a case of a user who did not pay the last installment because the subscription had expired earlier) and allow the user to manage any payment errors (for example insufficient funds). Since I added these 7 days, the last installment is less than the others because for the system only 7 days of subscription remain and not the whole month, so last invoice he pays only last 7 days

#

that's not good

#

do you understand?

azure tree
#

yes

#

I'm trying to think of a good way to solve it

charred carbon
#

last time you colleague tell me someting built in for installments

#

that i could set the number of installment i want on subscription

azure tree
#

this is called subscription schedules

#

this is I think even better for your case

charred carbon
#

when I use subscription schedules do I have to set the price currency monthly or is just needed to set subscription schedules iterations field to the number of installments?

azure tree
#

iterations is the way to go for installments

charred carbon
#

what does the end_behiavor field do?

#

i don't understand

#

in subscription schedules

compact wigeon
charred carbon
#

yes i don't understand what release and cancel values do

compact wigeon
#

If cancel, the underlying subscription would be cancelled when all phases are complete

#

If release, then the subscription would just go on following the natural billing cycle (monthly, etc)

charred carbon
#

oh ok, and when is set to cancel there is no hard delete right? The subscription will always be visible in dashboard even if canceled

compact wigeon
#

Correct yes, they're not deleted. Just in a terminal state (can't be reactivated)

charred carbon
#

subscription schedules don't return a client secret?

#

before to create a subscription I used $subscription = $stripe->subscriptions->create([...]) and in $subscription I had the object

#

now with $subscription = $stripe->subscriptionSchedules->create([..]) this don't return anything

#

sorry it return somenting different

compact wigeon
#

Yes, the schedule just facilitates creating a subscription object (where payment is facilitated) according to the specified schedule

charred carbon
#

But i need a client_secret to generate payment element, where to get it?

compact wigeon
#

From the initial invoice of the generated subscription

charred carbon
#

sorry, i don't want to refactor all my system with subscription schedules
Now i use subscription with currency monthly and cancel_at field based on number of installments I decide.
So if customer has 2 installments and the fist has been paid on subscription creation I set cancel_at field of his subscription at today's date +1 month, so the system can automatically charge only one more installment. It's happened that some subscription ended before the last installment has been paid, so i added +1 week to cancel_at field to all subscriptions. Now the problem is that Stripe in automatic calculates that the last installment is only for 1 week because from last installment date to cancel_at date the time remaining is 1 week so customer only pays for this 1 week and not the complete price of the installment. What can I do to make customers pay all installments the same price?

#

tell me if it's clear

compact wigeon
#

Yep, you should use subscription schedules really. It's the best approach for instalments like this

#

Otherwise you'll be wrestling with dates going forward

charred carbon
#

but now i use $subscription = $stripe->subscriptions->create([...]), if i replace it with $subscription = $stripe->subscriptionSchedules->create([..]) it's not the same thing

#

the last method don't generate payment_intent and client_secret

compact wigeon
#

Correct, it doesn't. Those would still exist on the subscription (invoice, really) that the schedule creates

charred carbon
#

so for getting payment_intent and client_secret i need to pick sub_id returned by subscriptionSchedules and get the subscription object via API?