try {
$intent = $stripe->paymentIntents->create($payload);
header("Content-Type: application/json");
print( json_encode($intent->jsonSerialize() ));
} catch (\Stripe\Exception\RateLimitException $e) {
// Too many requests made to the API too quickly
error_log("ERROR: too many requests made to the API too quickly {$e->getError()->message}");
http_response_code(429);
} catch (\Stripe\Exception\CardException $e) {
// Card was declined
logAlert("Card was declined {$e->getError()->message}");
http_response_code(402);
} catch (\Stripe\Exception\InvalidRequestException $e) {
// Invalid parameters were supplied to Stripe's API
error_log("ERROR: invalid parameters were supplied to Stripe's API {$e->getError()->message}");
http_response_code(400);
} catch (\Stripe\Exception\ApiConnectionException $e) {
// Network communication with Stripe failed
error_log("ERROR: network communication with Stripe failed {$e->getError()->message}");
http_response_code(503);
} catch (\Stripe\Exception\AuthenticationException $e) {
// Authentication with Stripe's API failed
error_log("ERROR: authentication with Stripe's API failed {$e->getError()->message}");
http_response_code(511);
} catch (\Stripe\Exception\ApiErrorException $e) {
// generic error
error_log("ERROR: {$e->getError()->message}");
http_response_code(502);
} catch (\GuzzleHttp\Exception\RequestException $e) {
error_log("ERROR: YAY it hit the guzzle exception catcher");
error_log("ERROR: Guzzle error from paymentIntents create: {$e->getMessage()}");
http_response_code(500);
} catch (Exception $e) {
error_log("ERROR: {$e->getMessage()}");
error_log("ERROR: YAY it hit the exception catcher");
http_response_code(500);
}
Any help would be appreciated, this might not even be a stripe problem but it does create the payment intents for regular cards no problem. It only gives a 500 when i use a declined card.