Closed ibarral closed 6 years ago
Hello,
Yes, that's possible.
When you catch the exception, you can retrieve the raw output that Stripe has sent and retrieve the charge id from the error array.
Example:
try {
$charge = Stripe::charges()->create([
'currency' => 'USD',
'amount' => 123,45,
'card' => 'some-token',
]);
} catch (\Exception $e) {
$chargeId = $e->getRawOutput()['error']['charge'];
}
Hope it helps.
Hello,
Is there any way to get the Charge ID when the card is declined?
Thanks!