#bragma_best-practices

1 messages ยท Page 1 of 1 (latest)

serene stirrupBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1280876758606024747

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

marsh pier
#

Hello
There's no way to create an invoice for the subscription without creating the subscription.
A workaround would be to create a one-time invoice, send that to the customer. Once they pay the one-time invoice, you can update their credit balance and create the subscription.

The credit balance should auto-apply to first invoice of the subscription - https://docs.stripe.com/billing/customer/balance

#

The other option would be to use trial period days for the first cycle

sweet grove
#

Just to elaborate on the 2 solutions I've tried:
Solution 1 has the problem that the first invoice must be paid within few hours, else the subscription will be canceled. Also, it must be created with a start time that is "lost" for the user since the subscription state is inactive.
Solution 2 has the problem to show the subscription as trial, generate a 0 value invoice, also the first invoice is not "related" to the subscription

#

Ok thanks! So you confirm the is no clean solution to this. Seems incredibile oversight for me

marsh pier
#

It is not an oversight really. This is just how billing works on Stripe.

I want to "assign" a subscription to a user, and have it activated in my product when the first invoice is paid
You can do that with subscriptions + webhooks. You can listen to invoice.paid events and provision your product when the subscription invoice gets paid.. Until then you can keep it "pending"

sweet grove
#

This is what I do in solution 1, but suppose that I create the subscription in stripe now for 3 months, invoice is sent, paid 5 days later, the subscription in my system will be "misaligned" with stripe start/cancel date

#

Not very clean. I'd like first invoice to activate the subscrption with start/cancel dates calculated on the payment date.

marsh pier
#

You can reset the billing cycle date when the invoice gets paid though

#

which moves the anchor

sweet grove
#

I also need to change the cancel_at, correct?

marsh pier
#

Correct

sweet grove
#

I mean, if I want to provide exatcly "3 months" worth days, correct?

#

Ok, thanks

#

Still seems a hack to me for something that I think is quite common ๐Ÿ™‚

marsh pier
sweet grove
#

Right. correct

#

Also I can't find it right now, but I seem to remeber the first invoice must be paid within 23 hours

#

This is a bit of a limit, sometimes crew send invoice requests before the weekend and the cusomters forget to check the emails for days

marsh pier
sweet grove
#

Ok, nice thank you

#

Personal question: how do you know so much about Stripe? ๐Ÿ™‚

marsh pier
#

My team serves as an eng interface between our users and all of our product teams as well as docs team etc, so we familiarise with pretty much everything ๐Ÿ˜…

#

Also we get variety of questions from Stripe users so the knowledge just keeps on adding

sweet grove
#

Thank you so much, I owe you a coffee

marsh pier
#

No worries! Happy to help

sweet grove
#

Ok, I'll abuse you just one last time:
If I want to create a subscription interactively (the user buys via app), I set CollectionMethod="charge_automatically" and PaymentBehavior="default_incomplete", send the invoice/intent data to the app, and wait for the button to be pressed. The subscription will be inactive for max 23 hours and become active when the user presses the damn button.
If I want to create a sub "offline", I create it with CollectionMethod="send_invoice", set a DaysUntilDue appropriately and the subscription will become immediately active. If the user never pays, too bad for me.

marsh pier
#

Correct, you can use due date as your pointer to cancel/delete the subscription as a cleanup job

sweet grove
#

Ok, not exactly whay I wanted and my customers preferred, but I suppose they'll have to live with it

marsh pier
#

There's also payment_behavior = allow_incomplete
if I recall correctly, the invoice won't be voided automatically after 23 hours in this case.

Let me see if I can test this really quick

#

however though, you'd need to have a saved payment method for the customer already

sweet grove
#

That's not the case for me. The customer may exist or may not, and not have a savad payment method

marsh pier
#

Gotcha. In that case, the options you outlined would be ideal

sweet grove
#

๐Ÿ‘

#

Thanks, have a good day