#neto-dev_api

1 messages ¡ Page 1 of 1 (latest)

serene tulipBOT
#

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

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

graceful nest
#

The timing of when I receive the upcoming event is not configurable

You can configure this in the Dashboard

#

However, I do not know if there is any clear way around the issue with using Boleto

wise yoke
#

in /settings/billing/automatic? "Upcoming renewal events"?

#

Set 3 days in this option, but the upcoming events are still triggered from 7 to 3 days. Not following this configuration.

#

Can you confirm for me if there's any solution to my problem? This is related to our entire subscription system at my company, having a major impact.

graceful nest
#

Can you confirm for me if there's any solution to my problem?
The problem being the 3 day due date? Unfortunately that is imposed by Boleto so the solution would be to stop accepting Boleto.

#

in /settings/billing/automatic? "Upcoming renewal events"?

Yes this is where you select how many days in advance you want to be notified.

wise yoke
#

Yes, I understand that the boleto comes with a 3-day due date. To work around this, my idea was to create the invoice several days before the subscription to solve this problem. However, I have the issues I mentioned above - if I create an individual invoice, the automatic subscription invoice is still being created anyway.

The "upcoming renewal events" option doesn't change anything the event notifies whenever it wants at any time.

#

Can you think of any solution that would work around this without stopping the use of boleto?

graceful nest
#

If you create a new invoice it will result in odd prorations. We don't allow pre-billing currently so you cannot create an Invoice for a billing cycle that has not started yet

#

Do you know what API version you are on?

wise yoke
#

API Stripe: 2025-02-24.acacia
SDK Stripe: ^17.7.0

wise yoke
graceful nest
#

Okay so that helps me explain how you can solve this (if you want). It takes advantage of the change we made to how Invoices and Payment Intents are related to each other.

What you could do is, when you get the invoice.upcoming webhook event, create a separate Payment Intent for the same amount using payment_method_types=['boleto'] and request your customers to pay it before the Invoice is generated.

Once the Invoice is generated and in Draft state, you can attach the Payment Intent to that Invoice using the API: https://docs.stripe.com/api/invoices/attach_payment

If the amount in the Payment Intent matches the amount in the Invoice, the Invoice is marked as Paid.

wise yoke
#

My objective is for the client to pay the subscription amount 3 days before the cycle ends. For example, if the cycle ends on September 17th, I need the client to receive the subscription invoice on September 14th. How am I going to link the payment intent with this invoice if the subscription invoice doesn't exist yet on the 14th?

serene tulipBOT
graceful nest
#

That is what I just described.

  • You create a separate Payment Intent (not related to the Invoice) 3 days before the Invoice is generated.
  • Your customer pays that payment intent using Boleto
  • When the Invoice is created, you attach the Payment Intent: https://docs.stripe.com/api/invoices/attach_payment
  • This marks the Invoice as paid automatically
wise yoke
#

I understand, maybe instead of matching with the amount I could use a key in the metadata, right?

graceful nest
#

I'm not sure I follow.

The amount of the Payment Intent must match the amount of the Invoice or either the attach request will fail or the Invoice will not be marked as paid.

But if you are asking how you keep track of what Payment Intent matches what Invoice, that is up to you. Metadata could be a good way to keep track.

wise yoke
#

Ah perfect, now I understand. I'm going to test this implementation, can you leave the chat open?

graceful nest
#

We close threads due to inactivity after ~45 minutes but my colleagues and I will be happy to answer any new questions you have while testing this out. You can always create a new thread by filling out the form in the #help channel.

wise yoke
#

OK thank you for the support my friend