#mochihealth

1 messages ยท Page 1 of 1 (latest)

near raftBOT
still sorrel
#

Hey there

#

So there are a couple ways to do this.

#

The easiest way to do this is to actually just update your Subscription to have a one-month trial period after you start it and take payment for the initial invoice.

#

The second way to handle this would be to use a Subscription Schedule as you noted which starts now but has two phases. The first phase would be the prepay and then the second phase would be the actual Sub

#

Also realizing I mispoke on that first one

#

You would have a trial of one month + the first billing period

fair torrent
fair torrent
fair torrent
#

how would I set the first phase for prepay

still sorrel
#

Honestly more complicated than option one imo

fair torrent
#

thanks and for option one can you elaborate on that one too?

still sorrel
#

Sure you just create a Sub with the Price that you would eventually use. Then you update the Sub to set a trial_end (https://stripe.com/docs/api/subscriptions/update#update_subscription-trial_end) to whenever the second Billing Period would be (when the customer should start paying for the Subscription again).

fair torrent
#

but wouldn't this charge the customer only after the trial end and not right away

still sorrel
#

No you update after you take the initial payment

#

So start Sub --> customer pays initial invoice --> update Sub to trial until you actually want Sub to start + 1 cycle since the initial cycle was already paid for

fair torrent
#

so basically charge them as a regular subscription that starts now and the after they pay make a call to stripe api to update that subscription to a trial until I would wan the actual subscription to start?

#

can you elaborate on the "+ 1 cycle since the initial cycle was already paid for"

still sorrel
#

Well if they are "pre-paying" then they already are paying for the first billing cycle right?

#

Like they already pay for the first month of the Sub if it is on a monthly Price?

fair torrent
#

so there are two cases that I want to build for. 1 is for regular monthly subscriptions and the other is actually a one time subscription for 3, 6, and 12 months that doesn't renew

still sorrel
#

Okay well let's start with the first one

#

So for that the customer pays Dec 1 but wants to start the Sub on Dec 15. They have already paid for Dec 15 - Jan 15, so you update the Sub after the initial payment to be on trial until Jan 15.

#

Does that make sense?

fair torrent
#

yea so would I have to catch that through a webhook on successful payment event to know when to trigger that update logic

still sorrel
#

Webhooks are definitely the recommended route, you are going to need them any way to handle Subscriptions.

fair torrent
#

yea that is super helpful

#

so would you be able to tell me which webhooks are the most important to listen for when integrating stripe subscriptions

#

and also how about the second case of a one time subscription for 3, 6, and 12 months that doesn't renew

still sorrel
still sorrel
fair torrent
#

yea

still sorrel
#

Okay so in that case you could just use a one-off invoice, or even just take a one-time payment, and not use a Subsription at all.

#

Or, you can use a Subscription Schedule that has an end_behavior: cancel set

fair torrent
#

yea I was looking into the Subscription Schedule option with the end_behavior: cancel set but i didnt konw how to charge upfront for that

still sorrel
#

Yep you would use the two phases in this case like we discussed above.

fair torrent
#

but you are saying that the one time payment would be easier?

#

the thing with that is can i schedule it to start in the future but charge now for a one time payment

still sorrel
#

The one-time payment is definitely easier, the only caveat is you have to track in your own database when the Subscription runs for so you can handle provisioning.

fair torrent
#

so like they could pay for it now with one time payment and in the backend when i got the webhook event for successful payment i would have to handle the logic of provisioning for when it starts?

#

I wouldnt be able to rely on a webhook to tell me when the subscription is active for this option correct? because all I know is that they paid for this product and there is no extra meta data that you can use with one time payments that would trigger a webhook event when I actually want the subscription to start

still sorrel
#

Yep that is what would be needed with one-time

#

You could set metadata on the one-time PaymentIntents

#

To ingest in your backend

fair torrent
#

but if I used the schedule subscriptions api will a webhook event fire when they get off the "trial" so I can know when to provision them access to our services

still sorrel
#

Yes if you use a $0 Price then the Sub transitions to active

#

And it won't charge

fair torrent
west marten
#

Hello, apologies for the delay, bismark had to step out and I am just catching up here. Looking in to this now

#

And add that as an item in the first phase

fair torrent
#

hey all good. let me ask you for recurring payments is there somewhere we need to store the customers payment details or stripe takes care of charging the original payment method automatically every month

west marten
#

As long as the payment method is attached to the customer and set as either the customer's invoice_settings.default_payment_method or the subscription's default_payment_method we will attempt to charge it automaticall

#

Oh and the subscription's collection_method needs to be charge_automatically but it sounds like that is what you are already doing

fair torrent
#

so at what point would I attach the customer and set as either the customer's invoice_settings.default_payment_method. when they are actually paying?

west marten
#

That would be charged when the subscription renews.

#

Ah I see, you are asking about how to collect the initial payment as well. Quick question: are you making your own custom page to charge users from or are you directing them to the Stirpe hosted invoice page?

fair torrent
#

we are making our own page for now

west marten
#

Once you create the subscription schedule, that should create a subscription that has an invoice that has a payment intent

fair torrent
#

so right now the way we do it is that when someone creates an account i create a customer in stripe with their email and store it on our own db. when our user wants to create a subscription i query the prices that were created on stripe to display to them, they choose one and i create that subscription on our end and send back the client secret to the frontend for them to fill out their payment information through stripe elements. once they do that and press confirm i call the confirm payment api through the frontend. so what I'm asking at what point would I save the payment details on the customer object that is on stripe in that flow

#

also please let me know if that is the correct flow or if I should change it to one that follows better practices

burnt anvil
#

Hi there ๐Ÿ‘‹ taking over for @west marten

Give me a few minutes to get caught up.

#

at what point would I save the payment details on the customer object that is on stripe in that flow
The Payment Method is saved once the Customer completes entering their payment info to the Payment Element and you confirm it.

fair torrent
#

but is the payment method saved in the subscription or on the customer object