#alexanderg-PaymentIntent-Decline
1 messages ยท Page 1 of 1 (latest)
Hello
Is there a message related to that exception?
Do you have the request id (req_123) or PaymentIntent id (pi_123) for a time when this has happened?
Thank you
I am looking to get pi_3JafO5I7FT03hK3l1El5ZjQx while making API call PaymentIntent.create
(the fact that it failed is correct - just need to get the id, ideally in the same call)
Are you catching it as a CardException? https://stripe.com/docs/api/errors/handling
We are catching generic Exception but if you have details please let me know which exception I should catch to cover card auth failure scenarios and how to extract id from there.
That doc says CardException
// Use Stripe's library to make requests...
} catch (CardException e) {
// Since it's a decline, CardException will be caught
System.out.println("Status is: " + e.getCode());
System.out.println("Message is: " + e.getMessage());
}```
CardException does not have the id of the created PaymentIntent
Once the call is over how could I link the failure to the specific intent created in Stripe
@lilac onyx oh sorry I joined the thread and missed this, give me a sec
there should be a e.payment_intent property on that error, right? which should contain the full PaymentIntent
log out the full e object to see
I am unable to see this property in Stripe API CardException or its superclass
this is Java right?
Correct
yeah I'm not sure off hand, let me check
like the API returns the error, Java deserializes it into an object so it just might be somewhere else on that object etc
also can you share the request ID associated with the error? You'll find it on your Dashboard https://dashboard.stripe.com/test/logs/
Thank you! ๐
@lilac onyx just to confirm you want to get the PaymentIntent id after the error you get on capture?
If so you want something like this: } catch (InvalidRequestException e) { System.out.println("Error message is : " + e.getMessage()); String paymentIntentId = e.getStripeError().getPaymentIntent().getId(); System.out.println(paymentIntentId); }
yes
Thank you ๐