#neto-dev_api

1 messages ¡ Page 1 of 1 (latest)

hushed hearthBOT
#

👋 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/1395575617302298831

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

lime pike
#

Need to generate invoices 3 days before subscription billing cycle to avoid payment gaps with boleto payments
Hello Stripe Support,
I work at a company in Brazil and we're using Stripe for our credit card and boleto (bank slip) subscriptions. However, I'm facing the following limitation:
The Problem: Currently, invoices are generated on the subscription's recurring billing date. For boleto payments, the due date is automatically set to 3 days after generation. This creates a total gap of recurring date + 3 days due date for our users.
What I Need: I need invoices to be sent to my clients 3 days BEFORE the subscription's recurring billing date to eliminate this 3-day gap.
What I've Tried:

I attempted to use the invoice.upcoming webhook event to generate an invoice before the subscription billing cycle, but encountered these barriers:

The timing of when I receive the upcoming event is not configurable, so I can't control when the invoice will be generated

Even when I generate an invoice 7 days early using the upcoming event, the automatic subscription invoice is still generated on the recurring billing date
I tried methods to prevent the automatic subscription charge from being generated, including:

Using trial end
Modifying the subscription anchor
But none of these approaches worked

In the upcoming event, I generated a payment intent and when the subscription invoice was generated, I tried to attach it, but it didn't work because to generate the upcoming event, the collection method needs to be "charge automatically", and to attach it, the collection method needs to be "send invoice"

My Question: What other options exist to solve this problem? I need to generate invoices 3 days before the billing cycle while preventing the automatic invoice generation on the actual billing date.
Thank you for your assistance.

fiery sky
#

hi there, give me awhile to catch up

#

You can try this workaround:

  • Create a one-time invoice to collect the subscription's "first payment"
  • If the one-time invoice succeeds, you can provide credits to the Customer Invoice Balance: https://docs.stripe.com/billing/customer/balance
  • Then create the subscription, and then pay the first invoice using the credits you've granted under the Customer Invoice Balance
#

to be clear, the credits you're granting to Customer Invoice Balance is what the customer has already paid for via the one-off invoice created in Step 1.

#

So if the one-time invoice fails, then no subscription will be created.

lime pike
#

Would this work for all months throughout the entire subscription period?

#

The subscriptions are already created, I basically need the client to receive the invoice 3 days before the subscription date

fiery sky
#

Yes it would work but it could be complex. For every invoice the subscription generates as it progresses through billing cycles, your payment integration will have to generate a one-time invoice to send to the customer for payment 3 days early.

#

By default, it is currently not possible to trigger a subscription to create invoice early.

lime pike
#

I couldn't generate this invoice in the upcoming event? I don't want to have to use cron jobs for anything, if I have to use them I'd prefer to manage my subscriptions myself

fiery sky
#

what do you mean by "generate this invoice in the upcoming event"?

lime pike
#

A few days before the automatic invoice generation of my subscription, Stripe sends a webhook called upcoming invoice. My question is whether I can generate this individual invoice when my API receives this event

fiery sky
lime pike
#

Yes, I'm using test clocks a lot, let me ask some general questions and about your solution

#

One possibility I had thought of was the following:

In the upcoming event, I create the payment intent, and when the subscription invoice is generated on the recurring date, I check if the payment intent was paid and mark it as won/paid via API as soon as the invoice is created. Would this solve my problem?

#

is possible?

fiery sky
#

Yup it is possible.

lime pike
#

If it were your application, which solution would you apply?

fiery sky
#

I can't provide advice for that. It would depend on each individual requirements

lime pike
#

No problem, could you tell me which solution you think is cleaner and more scalable?

fiery sky
#

I'm sorry, that's the same question but phrased differently.

lime pike
#

Perfect, I would like to ask some questions about your solution

#

in the upcoming event I will generate this invoice that will add the balance to the customer.

how will I ensure that in the create event, the invoice that is created is paid with the balance that was added?

fiery sky
lime pike
#

Perfect, would there be any other documentation link that would help me with this implementation?

fiery sky
#

Not as of now unless you have other specific questions

lime pike
#

Sure, thank you very much for your attention and patience

fiery sky
#

you're welcome

lime pike
#

you are the GOAT

#

someday we'll play valorant together

#

only if your solution works