我想处理这个错误,但是我无法让它在我的catch
中工作。我试过使用多个错误短语,例如Stripe\Error\InvalidRequest
和invalid_request_error
,但它们都不起作用。条纹如何处理InvalidRequest错误
注:我只包括必要的代码,我的支付系统工作正常。
这里是我的代码:
try {
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => $amount,
'currency' => strtolower($active_user->currency->currency_id)
));
}
catch (Stripe\Error\InvalidRequest $e) {
$msg = "Sorry, you cannot make the same payment twice.";
}
试试这个http://stackoverflow.com/a/8439615/2156785 – ANjaNA