#tymm

1 messages ยท Page 1 of 1 (latest)

scenic pagodaBOT
scenic spoke
#

You specify it by the start_date of each phases

latent oak
#

what if i wanna calculate the proration for the first month when the customer subscribes?

rare lance
#

Hey! Taking over for my colleague. Let me catch up.

rare lance
latent oak
#

hi i wanted to make customer pay upfront for a subscription basically

#

what are ur suggestions

#

and also, i will need to set billing cycle on 1st of every month
therefore, eg:

product 1 is $10/month
customer subscribe to product 1 on 15th of the month, so $5 for 1st month + $10 for next month, so $15 in total for the first invoice

automatic payment collection continues from the 3rd month onwards

rare lance
rare lance
latent oak
#

yes i have already done that, its just that i want to charge customer for $15 on the first month like i said in the previous message

#

i was told that subscription schedule can help but after playing around with it i couldnt find a way to apply proration + charge customer for upfront payment

rare lance
#

In that case you can set the billing_cycle_anchor to the first of the next month:
https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_cycle_anchor
If you want to make your customer pay up front, then you can fetch the upcoming invoice of a customer and ask him to pay it using your integration:
https://stripe.com/docs/api/invoices/upcoming
The customers can pay it via this link in this attribute:
https://stripe.com/docs/api/invoices/object#invoice_object-hosted_invoice_url

scenic spoke
latent oak
#

i tried getting the paymentintent of the upcoming invoice however it's null

rare lance
#

Ok I think I made a confusion, the upcoming invoice is just an preview and you can't finalize it

#

In your case you need to use subscription_schedule:
1- Create a first phase with one Month and 15 days (from 15th of the current month to the end of the next month), the first invoice will include all the periode (5$ +10$)
2- Create a next phase of 1 month and which starts at the 1st of the month

latent oak
#

for 1, i have tried to do that by setting startdate of "NOW" and enddate of 1st of nov, is this suffice?
for 2, do i do this while creating the schedule or must i update the schedule because i cant seem to set the startdate in create

#

and also how do i set the schedule to only renew the 2nd phase?

rare lance
latent oak
#

im using SubscriptionScheduleCreateParams.Phase.builder() and i cant see setStartdate

#

this is the subid of the subscription i created with subscription schedule sub_1LmDSnLK0bfo5HSblZLepPoc

#

this is the code snippet

        SubscriptionScheduleCreateParams params = SubscriptionScheduleCreateParams.builder()
                .setCustomer(customerid)
                .setStartDate(SubscriptionScheduleCreateParams.StartDate.NOW)
                .setEndBehavior(SubscriptionScheduleCreateParams.EndBehavior.RELEASE)
                .addPhase(
                        SubscriptionScheduleCreateParams.Phase.builder()
                                .addItem(SubscriptionScheduleCreateParams.Phase.Item.builder()
                                        .setPrice(priceid)
                                        .setQuantity(2L)
                                        .build())
                                .setProrationBehavior(SubscriptionScheduleCreateParams.Phase.ProrationBehavior.CREATE_PRORATIONS)
                                .setEndDate(1667253600L)
                                .build()
                )
                .addPhase(
                        SubscriptionScheduleCreateParams.Phase.builder()
                                .addItem(SubscriptionScheduleCreateParams.Phase.Item.builder()
                                        .setPrice(priceid)
                                        .setQuantity(2L)
                                        .build())
                                .setIterations(1L)
                                .build()
                )
                .build();

        SubscriptionSchedule schedule = SubscriptionSchedule.create(params);
iron kiln
#

Hi! I'm taking over this thread.

#

Could you summarize what you are trying to achieve exactly?

latent oak
#

im expecting the next invoice to come in nov 1?

rare lance
latent oak
latent oak
# iron kiln Could you summarize what you are trying to achieve exactly?

hi i wanted to make customer pay upfront for a subscription basically

plus i will need to set billing cycle on 1st of every month
therefore, eg:

product 1 is $10/month
customer subscribe to product 1 on 15th of the month, so $5 for 1st month + $10 for next month, so $15 in total for the first invoice

automatic payment collection continues from the 3rd month onwards

i was advised to use subscription schedule to achieve this

rare lance
#

Sorry, I was testing something,

#

a first phase until 31th of October and a second one for only one month

latent oak
#

and also the amount charged was only for a month, it should be more than 280, with the prorated charges from today till 1st of oct

rare lance
#

The price you are using is this one price_1LSwiJLK0bfo5HSbel7zQZah which is 140MYR/month, the first invoice is including 2 months

latent oak
latent oak
rare lance
#

I understand your issue, it's regarding the billing cycle anchor of the invoices. You want to bill in advance for the full next month with the remaining days of the current months. Then every first of the month you charge your customer. I'm doing some tests so far, but it looks not possible by default.
You can keep the actual invoice cycle month by month (starting from 26th), and let the subscription phases iterate separately by phases. At the end of the subscription schedule, the last period will be a prorated for the remaining days

latent oak
#

ok i guess i'll find another way to do this, thanks for ur help today, talk to u later
if u have any new ideas regarding this please drop a message here, i'll be checking tomorrow. ๐Ÿ™‚