#brinda_subscription-payment-failing
1 messages · Page 1 of 1 (latest)
👋 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/1232629034811134049
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
yes
you can check the Invoice object, which contains this link: https://docs.stripe.com/api/invoices/object#invoice_object-hosted_invoice_url
or you can check the PaymentIntent object, and directly use the client_secret with the Payment Element to collect the payment
how can i implement this with java
I shared multiple options above, which one you want to implement?
i have below object that doesn't contains invoice object
please review the object and give me solution
i want to generate a link that contains all the details for which it wan failed and by single click on that link stripe payment done
this PaymentIntent is NOT for a subscription, so there's no Invoice.
and that payment was simply delcined by the bank
ok wait i send you a other object
so you have two options:
- tell te user to contact their bank to undertsand the issue
- or ask them to pay again with a different payment method
in this object invoice are there
so how can i handle multiple case for subscription failed payment and other failed payment
when recurring payment fails, Stripe will automatically handle this based on your settings here: https://dashboard.stripe.com/settings/billing/automatic
but i dont want that setting i want to implement that logic in my web app
when user clicks on email link they can pay directly for failed paymwent
sure you can built that logic youtslef, but that will be a lot of work
I recommend reading this: https://docs.stripe.com/billing/subscriptions/webhooks#payment-failures
i already read this
but our client wants that whole logic in put system
how can i implement this in my system
it's explained in the link I shared above:
If a payment fails, there are several possible actions to take:
- Notify the customer.
- If you’re using PaymentIntents, collect new payment information and confirm the PaymentIntent.
- Update the default payment method on the subscription.
i have this object that i sent to you , and want to implement this in event catching by webhook
out client doesn't want to go outside of app for just an email to repay
same system work wants in out webapp
how can i do this
then send an email with the hosted invoice email, as I suggested earlier: https://docs.stripe.com/api/invoices/object#invoice_object-hosted_invoice_url
by that url repay can be done?
yes it's a page to pay the invoice
or if again fail then what to do
that's up to you
as per your review what we can done for this ?
email is better or lot of code is better for this
but if invoice is not finalized till that moment then how to manage it
I'm confused. if the payment failed, it means the invoice is finalized, so you do have access to the hosted invoice page.
ok by that hosted invoice page it contains all info for repay of their subscription failed payment
yes
but how can i manage that for infinite failed payment
means if user have problem in payment method or card or account then how many times i handle that case for failed payment
if retrying the payment fails, then you could cancel their subscriptions.
but how can i know that already that subscription payment failed and repay request already fails
that' something that you'll need to track on your end by listening to webhook events
by which event
invoice.payment_failed
means when subscription payment failed then payment_intent.payment_failed event caught
again i repay that ,
then invoice .payment_failed event occured?
when a subscription payment fails, you'll get both payment_intent.payment_failed and invoice.payment_failed. but it makes more sense to listen to invoice.payment_failed.
but how can i manage that for failed subscription i already tried for repay
I told you: you could cancel the subscription.
how can i do this at coding level
its ok but for this i have to keep record for repay link sent payment_intent object with customer id and no of links sent
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
i want to implement logic of repay email sent in my system but i want that by api support
is that possible?
my colleague has already explained this
that for failed payment of subscription a link generated and by that link customer can repay
what part are you still struggling with
how can i handle this with again failed payment
you just listen to invoice.payment_failed events
and redo the same logic over and over again
but how many times i have to do this
as many times as you want
this is not right way that again and again payment fails
you can keep track of the times you sent the link by adding that info to the invoice metadata
how can this is possible
how can i do this at code level
please be more specific rather than using "this", please state exactly what you want help with
which part
adding the metadata? sending the invoice?
you can keep track of the times you sent the link by adding that info to the invoice metadata
this
both
first start reading the metadata docs https://docs.stripe.com/metadata
once you're familiar you can see how you can leverage the metadata when updating the invoice https://docs.stripe.com/api/invoices/update#update_invoice-metadata to keep track of that info
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok how can i do this at database level
you don't need a database for this
you just store the information on the invoice itself
on Stripe's side
ok but how can i check that for that invoice i already sent the payment link to user
ok so let's take it one step at a time
the first time you receive the invoice.payment_failed event
you check the metadata of the invoice object in that event
and you see you don't have any
so you go and send the Invoice to the customer for manual payment https://docs.stripe.com/api/invoices/send
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and you update the invoice's metadata to have something like invoice_sent: 1
next time you receive invoice.payment_failed you check the metadata and you see that you've already sent the invoice once
so you increment that number by updating the metadata and you send the Invoice to the customer for manual payment https://docs.stripe.com/api/invoices/send a second time
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and you do this as many times as you want
until at some point you say after x amounts I will stop sending the invoice and just cancel the subscription
this will be sent from a Stripe email address but the reply would be redirected to the email address you provide under Customer Support Email on this page https://dashboard.stripe.com/settings/update/public/support-details
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
the email will be sent specifically from
failed-payments+acct_xxx@stripe.com
i want to know the API that can give me a link to repay for subscription payment failure
acct_xxx would be your account ID
is there any api for this?
if you want to send your own email you can rely on https://docs.stripe.com/api/invoices/object#invoice_object-hosted_invoice_url as the URL to send your customers
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but that will only be available if the collection_method is send_invoice
how can i know that collection_method is send_invoice
actually
i mean from which object or which event
I think you have a better flow here
if you want the customer to update their payment method you can use the Customer Portal deep flows https://docs.stripe.com/customer-management/portal-deep-links#what-is-a-flow with a value of payment_method_update
once you create that, you will send the link to your customer
i already called the api for attaching payment method to customer
but when the payment fails, you want to collect new payment details
without payment method any customer can't subscribe
but if the payment fails, then you want the customer to provide a new one
brinda_subscription-payment-failing
ok
by hosted_invoice_url how can i repay the failed payment
means it is giving just simple details that amount and all
yes but in your case this field will be null
because you are creating a subscription that automatically charges a saved payment method
that's why
I suggested the other approach
i got the hosted_invoice_url then i want to repay link sent to ui side and on ui side there are one button by clicking on that repay will be done
is this possible by hosted_invoice_url?
I'm not sure you're following along
if you want our help, you need to be cooperative and read our answers
in your case, the hosted_invoice_url will be null
and you won't be able to use it
so creating a flow around it, would not be possible
i have the hosted_invoice_url
would you mind sharing the invoice ID please?
from invoice.payment_failed object
send the event ID please
sure
"id": "evt_1P8JFOSBOWg2gNqsrHrDnVjj"
in this i have hosted link
can i do repay with this link without any additional work?
yes
i just want simple thing that from backend that link will be sent to ui side
on ui side there is a button by clicking on that button url will be opened on new tab
sorry I meant I see the hosted_invoice_url there
but you can't use that to pay the invoice
because the collection_method is charge_automatically
but on browser when i open the link it is just guving an information about the invoice
this is from test account
but i send other event
wait
evt_1P7N5JLkkKrMgaUyc0AwoiOK
check for this
if there are issue in card and acocunt or payment method then can i handle this?
as the collection method is charge_automatically
this invoice is void as well
void means?
no longer payable
means there are issue in payment method or in subscription?
what's happening here is that you're creating a subscription with payment_behavior:default_incomplete which is basically the default for the API version you're using https://docs.stripe.com/api/subscriptions/create#:~:text=Use default_incomplete to,a terminal state
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
after 23 hours if the invoice is not paid, the subscription gets canceled and the invoice gets voided
by payment_intent.payment_failed event from which key i can know the proper error and type for customer display