#egli_invoice-events

1 messages ยท Page 1 of 1 (latest)

zealous spadeBOT
steep portalBOT
#

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.

zealous spadeBOT
#

๐Ÿ‘‹ 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/1272926123751116882

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

woeful scroll
#

def stripe
event = Stripe::Event.construct_from(params.as_json)

case event.type
when 'invoice.paid'
  handle_invoice_paid(event.data.object)
when 'invoice.marked_uncollectible'
  handle_invoice_uncollectible(event.data.object)
when 'invoice.overdue'
  handle_invoice_overdue(event.data.object)
when 'invoice.payment_failed'
  handle_payment_failure(event.data.object)
when 'invoice.voided'
  handle_invoice_void(event.data.object)
end

head :ok

end

#

for past due i added thsoe events, also invoice.updated but nothing

steep portalBOT
bright spade
#

Hi there ๐Ÿ‘‹ can you share the ID of an Invoice from your testing?

woeful scroll
#

yes 1 min

zealous spadeBOT
#

egli_invoice-events

woeful scroll
#

in_1PkpGhARjJ1na9ElzcvOQ23T

#

Also on events im not seeing and status change, only finalized

#

Stripe::Invoice.create(
customer: customer.customer_stripe_id,
auto_advance: false,
collection_method: 'send_invoice',
due_date: 30.days.from_now.to_i
)

JUst to mention that our logic is using send_invoice not automatic way

bright spade
#

Thank you for the additional context, I'll need a couple minutes to take a closer look.

woeful scroll
#

Ok Thanks

bright spade
#

It looks like there isn't a good Event type to listen for to get notified when an Invoice becomes past due, because that doesn't get reflected in the API object as a status or in any other field on the Invoice object.

To accomplish what you're after, you'll need to use Billing Automations:
https://dashboard.stripe.com/settings/billing/automations
This will allow you to specify that the invoice.overdue Event should be generated and sent, which you can then listen for in your webhook endpoint.

Similar to what is described here, but without the amount threshold, and using "send webhook" instead of "email team member"
https://docs.stripe.com/billing/automation-recipes#invoice-overdue-notifications

Learn how to use automations in Stripe to create custom dunning flows, manage customer communications, create custom notifications, and issue signup credits for new users.

woeful scroll
#

Thank you very much, i will take a look right now

#

Worked perfectly, thank you again ๐Ÿ™‚