#kiwimarc - failure
1 messages · Page 1 of 1 (latest)
Well it would depend on the failure. We don't raise an exception if the card is declined
Oh this is PHP. Maybe we do raise an exception in that library
Looking
You need to also catch ApiErrorException
so this?
catch (\Stripe\Exception\ApiErrorException $e) {
Yeah
still gets same error
Now I have every error Exception in the api librarie and i still get the same error
Can you share the stacktrace?
#0 stripe_create_payment(Array ([id] => 15,[user_id] => 1,[customer_guid] => 6fd56f27-a356-48ad-8ee8-2216b379acd8,[stripe_guid] => cus_Lzp2jo6ZQALahJ,[hash] => b7bbd690ee645430878604c8627ef7e1147129676f7b88f0e4b8cde1b1da9b5b0df892dc299e4a4ccf39696503533fd9798752a4e5d02efe81d4f0d88b38d8ba,[activation_expiry] => 2022-07-08 15:23:51), b45b2975-7015-4f2e-8173-5dbd53113f1d) called at [customer/tester.php:11]
Thats the only thing i can get
Not sure what that error means as I'm not a PHP expert
Is there any more?
If not, can you find the corresponding request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request?locale=en-x-debug#:~:text=Using the dashboard,the dashboard URL as well.
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
It just shows that it stops in the function that I have sent you
Ok I recommend adding logging statements in each block
So that you can narrow down the issue
I only have that one error code and that stacktrace
Yeah I recommend adding a lot of log statements throughout so you can narrow it down
But I know what is not working
I just don't know how I can catch it
I'm not familiar with PHP, but based off what you sent me it doesn't look like there's an uncaught exception
That's not an exception thrown message
Im trying to catch if a card declines which should be caught by CardException per the api dokumentation. But it don't catch it
try {
// Use Stripe's library to make requests...
} catch(\Stripe\Exception\CardException $e) {
// Since it's a decline, \Stripe\Exception\CardException will be caught
echo 'Status is:' . $e->getHttpStatus() . '\n';
echo 'Type is:' . $e->getError()->type . '\n';
echo 'Code is:' . $e->getError()->code . '\n';
// param is '' in this case
echo 'Param is:' . $e->getError()->param . '\n';
echo 'Message is:' . $e->getError()->message . '\n';
} catch (\Stripe\Exception\RateLimitException $e) {
// Too many requests made to the API too quickly
} catch (\Stripe\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Stripe's API
} catch (\Stripe\Exception\AuthenticationException $e) {
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
} catch (\Stripe\Exception\ApiConnectionException $e) {
// Network communication with Stripe failed
} catch (\Stripe\Exception\ApiErrorException $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {
// Something else happened, completely unrelated to Stripe
}
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you add more log statements to each catch block? Where exactly does the code stop?
Are you certain it's not caught in one of those catch blocks? Did you add log statements in each?
Yes I have tried to log in each catch block
It's the array in each catch block
I have now the log of the payment intent
Stripe\PaymentIntent JSON: {\n "id": "pi_3LJHlxQYLLbCg3pG0cGQiCNa",\n "object": "payment_intent",\n "allowed_source_types": [\n "card"\n ],\n "amount": 1281,\n "amount_capturable": 0,\n "amount_details": {\n "tip": []\n },\n "amount_received": 0,\n "application": "ca_F4vIZdxR6eufLuKvkasSk6BauJjRWHx6",\n "application_fee_amount": 0,\n "automatic_payment_methods": null,\n "canceled_at": null,\n "cancellation_reason": null,\n "capture_method": "automatic",\n "charges": {\n "object": "list",\n "data": [],\n "has_more": false,\n "total_count": 0,\n "url": "\/v1\/charges?payment_intent=pi_3LJHlxQYLLbCg3pG0cGQiCNa"\n },\n "client_secret": "pi_3LJHlxQYLLbCg3pG0cGQiCNa_secret_PriNRIIIZjCIwNI7ucclhfGYl",\n "confirmation_method": "automatic",\n "created": 1657288989,\n "currency": "dkk",\n "customer": "cus_Lzp2jo6ZQALahJ",\n "description": null,\n "invoice": null,\n "last_payment_error": null,\n "livemode": false,\n "metadata": [],\n "next_action": null,\n "next_source_action": null,\n "on_behalf_of": null,\n "payment_method": "pm_1LJEXSQYLLbCg3pGbR6s6H5m",\n "payment_method_options": {\n "card": {\n "installments": null,\n "mandate_options": null,\n "network": null,\n "request_three_d_secure": "automatic"\n }\n },\n "payment_method_types": [\n "card"\n ],\n "processing": null,\n "receipt_email": null,\n "review": null,\n "setup_future_usage": null,\n "shipping": null,\n "source": null,\n "statement_descriptor": null,\n "statement_descriptor_suffix": null,\n "status": "requires_confirmation",\n "transfer_data": null,\n "transfer_group": null\n}
"status": "requires_confirmation",
That indicates that there was no issue creating the payment intent
Looking into that payment intent now
I have found the error
Gotcha what was it?
it was because the try catch should be around the $stripe->paymentIntents->confirm and not the create