#ben_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1255968395468214423
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
Hi there ๐ are you testing Subscriptions, is that why you need a test card that can be attached first?
yes i am
Gotcha, that's tricky then, because as you're saying the test card can't first be attached to the Customer because the attachment fails validation.
I'll keep thinking on it to see if there is a better way to do it, but I think it'd probably be easiest if you mocked the requests to your system instead of trying to trigger real test Events. That way you can manually set the decline_code that you want to test in your request to test how your system handles that.
Well, you see, the thing I am trying to test, i first need to validate the inbound structure which i cannt seem to find in the docs.
Atm it seems we are logging failure_code but this looks like a generic 'bucket' if you like, e.g. card_declined. I need the decline reason, e.g. insufficient_funds, and i want to check where i can find this in the response
perhaps if you can point me to where i can find this, that would help
Can you tell me more about what you're looking at? Are these Events you're trying to parse, and if so what type of Event?
Yeah, so i want to simulate subscription charge failures and our webhook endpoint dealing with those. WE store this in our DB and surface them via websockets in the front end. But we tie error codes to ENUIMs, both in the backend and front end to display the appropriate translations.
Backend is laravel, front is react.
So i need to see the structure of a charge.failed event and sepcifically where the decline codes are
in the docs, for charges, failure_code references the error section, which for card_decline references a decline attribute but i cannot see this in the response example
charge.failed Events will contain a Charge object inside of them. So I believe you're looking for failure_code.
Do you have the ID of an example Event you can share?
well failure_code is a high level code. It will just say card_declined
"id": "evt_1PWO2oS0VeKkc4dxjWmxBhqw"
i might be able to find something in our prod system
Just making sure, that seems to be an invoice.payment_succeeded Event type, is that what you're looking at?
odd hang on
im looking at our prod events atm
see this
"failure_code": "card_declined",
"failure_message": "Your card has insufficient funds.",
"fraud_details": {
},
"invoice": "in_1PVhEkS0VeKkc4dxsF6Z9Qtd",
"livemode": true,
"metadata": {
},
"on_behalf_of": null,
"order": null,
"outcome": {
"network_status": "declined_by_network",
"reason": "insufficient_funds",
"risk_level": "normal",
"seller_message": "The bank returned the decline code insufficient_funds.",
"type": "issuer_declined"
},
im going to make an assumption and say i need outcome->reason
Yeah, reason looks like a good option. If you're leveraging Radar in your flows, I'd suggest taking a look at the description of that field here to make sure you're ready to handle the Radar related values that can appear there:
https://docs.stripe.com/api/charges/object#charge_object-outcome-reason
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
we arent using radar, im actuslly dont know miuch about it
Cool, shouldn't really be much of a concern then.