#mangle8582

1 messages · Page 1 of 1 (latest)

lone hatchBOT
#

Hello! We'll be with you shortly. 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.

pseudo fulcrum
#

Subscriptions don't cancel/delete on failed payment

atomic dirge
#

What's the best way to handle this?

#

Can i atleast have a status of not paid for that subscription? To show it on frontend

#

And after all retires to cancel the subscription?

pseudo fulcrum
#

You can but you'd manage the status in your databse

#

If payment fails, update the record in your db to not paid

#

Then you can use the above settings I linked to cancel sub automatically if all retries fail

atomic dirge
#

Do these settings work on test mode?

pseudo fulcrum
#

Yeah the live settings work in test mode

#

But you need to be aware that changing those settings will affect your live subs

atomic dirge
#

aa ok, thanks, can you suggest a webhook event on which to change status to not paid?

#

invoice.payment_failed or charge.failed or payment.intent.canceled

pseudo fulcrum
#

Up to you

#

Not the payment intent one

#

That's not a failed payment event

#

invoice.payment_failed works fine

atomic dirge
#

thanks!

#

Also, how can i trigger a retry payment directly from frontend?

#

if the status is unpaid?

#

which method should i call from stripe after i do a http request to backend API

pseudo fulcrum
#

It's the same way

atomic dirge
#

I use stripe elements to confirm the payment, but on failed payments i'm not sure which method to trigger from API stripe

pseudo fulcrum
#

You asked to do it on the frontend

#

That would be via elements

atomic dirge
#

And from backend side?

pseudo fulcrum
#

I'm confused why you want to do that

#

Aren't you relying on automatic retries already?

#

And cancelling automatically after x amount of them?

atomic dirge
#

I've added 1 day retry, after 1 day it will retry and it it fails it will cancel subscription, and it works good

#

But I need to add a button to the user on frontend, so it can call API and call Stripe to retry

pseudo fulcrum
#

Why

atomic dirge
#

User's subscription will be unpaid, and he cannot use the functionality of the app, so he needs a retry button to trigger the payment so it can be active again

#

He can't just wait 1 day of the automatic retry

pseudo fulcrum
#

You probably don't want a button that the user can spam as much as possible to call the stripe api and retry payment

#

Like you'd probably want them to be able to enter new card details

atomic dirge
#

Yeah, but entering new card details just triggers payment_method_attached only

#

I can just cancel the subscription on first payment_failed and he just adds his card again and create a new subscription and that's it

#

I thought i can add a retry button but you're probably right, it's not the best solution

pseudo fulcrum
#

Why not use the automations from your dashboard settings?

#

Like we provide functionality to email customer to fix their payment method

#

And handle all retries automatically

atomic dirge
#

I'm in an Electron app, i believe it's harder to redirect them to a URL.

And retries from dashboard settings i see they are per day.

#

If they could trigger the retry when changing payment method in the app it would be nice

atomic dirge
#

Yea, i can catch it on payment_method_attached but not sure which API method to call from Stripe to trigger the retry

pseudo fulcrum
#

It's the same

#

You just collect payment details and call confirm with the client secret from the invoice's payment intent

#

No need to listen for payment method attached

atomic dirge
#

Aaa call it from frontend with stripe elements right?

pseudo fulcrum
#

yes

lone hatchBOT
atomic dirge
#

Thank you!