#hassamsaeed
1 messages ยท Page 1 of 1 (latest)
it will cover all type of payment failed?
One time charge, subscription charge and many others
Why don't you recommend charge.failed event?
Do you create Charges or PaymentIntents?
Charges and Subscriptions
If you do create Charges, then you should use charge.failed. However note that we don't recommend using charge's as it's an old API. Instead you should create PaymentIntents (that's why I recommneded payment_intent.payment_failed).
I need to integrate webhook to an existing application not new one. So Payment_intent.payment_failed will handle charges and subscription?
I need a detailed reason why my charge has been failed
If your integration is directly creating charges, then you have to use charge.failed.
Like this one
which webhook gives me the detailed description like the screenshot that i sent above?
The charge.failed event will contain a Charge object, which has a failure_message property: https://stripe.com/docs/api/charges/object#charge_object-failure_message
PaymentIntent has a last_payment_error property. But again, if you directly create a Charge object, then you won't receive a payment_intent.payment_failed event.
Lemme check both of these. Basically our app uses two types of charges
- Direct charge (One time charge using card)
- Subscription based charges
Direct Charge can be either a PaymentIntent or a Charge, so I don't know. Can you share a specific example so I can check?
Subscription will create invoices that will create PaymentIntent that contain a Charge.
We are using this method for one time charge
Stripe.charges.create({})
And for subscription
Stripe.subscriptions.create({})
Got it, so you are creating Charges and Subscriptions. So if you want to listen to a single event, that would be charge.failed.
okay sure thanks. let me check then i will get back to you if i need more help
I need to add card to give me the insufficient funds when i create a charge.How may i add the card?
It does not allow me to add the card
Use this card 4000000000000341
Sure
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Sure
Are you there?
What is the issue here?
it is just a username:password for authorization
I don't think we accept this kind of URLs
got it
you shouldn't worry about adding basic or any sort of authentication
I type : instead of @
verifying the signature is enough to see if this is a message that was sent by Stripe or not
What does this object means?
outcome: {
network_status: 'declined_by_network',
reason: 'generic_decline',
risk_level: 'normal',
risk_score: 12,
seller_message: 'The bank did not return any further details with this decline.',
type: 'issuer_declined'
},
inside the charge.failed webhook
this is a generic decline from the issuing bank
I need a detailed message like the screenshot that i sent above. How can i get?
Please see my screenshot that i sent to @dim frost
I need a card which attaches with the customer successfully but while creating a charge it gives me an error about insufficient funds
then you can use the one that my colleague sent you
it gives me an error about general decline
outcome object will always be return. Right?
Hey! Taking over for my colleague. Let me catch up.
Not sure if it's returned in all possible cases
then how i will handle the webhook generic case?
Could you please give more details, what you mean exatcly by generic case and what webhook event are you listening too ?
You can refer to the decline code and refer to this page to see what action can be done:
https://stripe.com/docs/declines/codes
for generic_decline => The customer needs to contact their card issuer for more information.
How i get this message from webhook?
This is the response which i get from webhook
I hope you get my point
In the webhook you have just the code, you can create a mapping of code=> message from the link I shared above and display that to your customer.. you may need to manage translation in case you have multiple language support ...
Okay sure.
What if i get the message from outcome object seller_message property?
You can but I can't garantee that for all cases it exists
Okay sure. but the code will always be present in the outcome object. Right?
I'm not sure that the outcome object is present in all possible decline case... you may need to refer to failure_code and failure_message
https://stripe.com/docs/api/charges/object#charge_object-failure_code
But the failure_code is card_decline that is not present in the decline link that you mentioned. How may i redirect user to that page
that is not present in the decline link that you mentioned. How may i redirect user to that page
You can't you need to
create a mapping of code=> message from the link I shared above and display that to your customer.. you may need to manage translation in case you have multiple language support ...
Okay sure Thanks
Welcome!