#brinda_subscription-payment-failing

1 messages · Page 1 of 1 (latest)

nocturne echoBOT
#

👋 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.

teal shuttleBOT
jolly dagger
#

hi there!

#

are you talking about failed payments for Subscriptions here?

vital token
#

yes

jolly dagger
#

or you can check the PaymentIntent object, and directly use the client_secret with the Payment Element to collect the payment

vital token
#

how can i implement this with java

jolly dagger
#

I shared multiple options above, which one you want to implement?

vital token
#

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

jolly dagger
#

this PaymentIntent is NOT for a subscription, so there's no Invoice.

#

and that payment was simply delcined by the bank

vital token
#

ok wait i send you a other object

jolly dagger
#

so you have two options:

  1. tell te user to contact their bank to undertsand the issue
  2. or ask them to pay again with a different payment method
vital token
#

in this object invoice are there

#

so how can i handle multiple case for subscription failed payment and other failed payment

jolly dagger
vital token
#

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

jolly dagger
#

sure you can built that logic youtslef, but that will be a lot of work

vital token
#

same link i want to generate from backend side in java

#

for repay

jolly dagger
vital token
#

i already read this

#

but our client wants that whole logic in put system

#

how can i implement this in my system

jolly dagger
#

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.
vital token
#

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

jolly dagger
vital token
#

by that url repay can be done?

#

or if again fail then what to do

jolly dagger
#

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

vital token
#

as per your review what we can done for this ?

#

email is better or lot of code is better for this

vital token
jolly dagger
#

I'm confused. if the payment failed, it means the invoice is finalized, so you do have access to the hosted invoice page.

vital token
#

ok by that hosted invoice page it contains all info for repay of their subscription failed payment

jolly dagger
#

yes

vital token
#

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

jolly dagger
#

if retrying the payment fails, then you could cancel their subscriptions.

vital token
#

but how can i know that already that subscription payment failed and repay request already fails

jolly dagger
#

that' something that you'll need to track on your end by listening to webhook events

vital token
#

by which event

jolly dagger
#

invoice.payment_failed

vital token
#

means when subscription payment failed then payment_intent.payment_failed event caught
again i repay that ,

#

then invoice .payment_failed event occured?

jolly dagger
#

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.

vital token
#

but how can i manage that for failed subscription i already tried for repay

jolly dagger
#

I told you: you could cancel the subscription.

vital token
#

how can i do this at coding level

jolly dagger
vital token
#

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

nocturne echoBOT
honest peak
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

vital token
#

i want to implement logic of repay email sent in my system but i want that by api support

#

is that possible?

honest peak
#

my colleague has already explained this

vital token
#

that for failed payment of subscription a link generated and by that link customer can repay

honest peak
#

what part are you still struggling with

vital token
#

how can i handle this with again failed payment

honest peak
#

you just listen to invoice.payment_failed events

#

and redo the same logic over and over again

vital token
#

but how many times i have to do this

honest peak
#

as many times as you want

vital token
#

this is not right way that again and again payment fails

honest peak
#

you can keep track of the times you sent the link by adding that info to the invoice metadata

vital token
#

how can this is possible

vital token
honest peak
#

please be more specific rather than using "this", please state exactly what you want help with

#

which part

#

adding the metadata? sending the invoice?

vital token
#

you can keep track of the times you sent the link by adding that info to the invoice metadata
this

#

both

honest peak
vital token
#

ok how can i do this at database level

honest peak
#

you don't need a database for this

#

you just store the information on the invoice itself

#

on Stripe's side

vital token
#

ok but how can i check that for that invoice i already sent the payment link to user

honest peak
#

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

#

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

#

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

vital token
#

ok

#

email link can get from any api support?

#

hello

honest peak
#

the email will be sent specifically from
failed-payments+acct_xxx@stripe.com

vital token
#

i want to know the API that can give me a link to repay for subscription payment failure

honest peak
#

acct_xxx would be your account ID

vital token
#

is there any api for this?

honest peak
vital token
#

ok

#

thank you

honest peak
#

but that will only be available if the collection_method is send_invoice

vital token
#

how can i know that collection_method is send_invoice

honest peak
#

actually

vital token
#

i mean from which object or which event

honest peak
#

I think you have a better flow here

#

once you create that, you will send the link to your customer

vital token
#

i already called the api for attaching payment method to customer

honest peak
#

but when the payment fails, you want to collect new payment details

vital token
#

without payment method any customer can't subscribe

honest peak
#

but if the payment fails, then you want the customer to provide a new one

nocturne echoBOT
#

brinda_subscription-payment-failing

vital token
#

ok

#

by hosted_invoice_url how can i repay the failed payment

#

means it is giving just simple details that amount and all

honest peak
#

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

vital token
#

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?

honest peak
#

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

vital token
#

i have the hosted_invoice_url

honest peak
#

would you mind sharing the invoice ID please?

vital token
#

from invoice.payment_failed object

honest peak
#

send the event ID please

vital token
#

sure

#

"id": "evt_1P8JFOSBOWg2gNqsrHrDnVjj"

#

in this i have hosted link

#

can i do repay with this link without any additional work?

honest peak
#

yes

vital token
#

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

honest peak
#

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

vital token
#

but on browser when i open the link it is just guving an information about the invoice

honest peak
#

oh nvm! the invoice you sent me is void

#

that's why you can't pay it anymore 🤦

vital token
#

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

honest peak
#

this invoice is void as well

vital token
#

void means?

honest peak
#

no longer payable

vital token
#

means there are issue in payment method or in subscription?

honest peak
#

after 23 hours if the invoice is not paid, the subscription gets canceled and the invoice gets voided

vital token
#

by payment_intent.payment_failed event from which key i can know the proper error and type for customer display

spice bay
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

#

You can fetch the related Charge object, and you will see the exact error.