【发布时间】:2020-04-02 14:09:34
【问题描述】:
我正在努力寻找一种解决方案来处理来自 Slim 中 Stripe 的错误消息。当我收到回复时,Slim 正在加载:
<h1>Slim Application Error</h1>
<p>The application could not run because of the following error:</p>
<h2>Details</h2>
<div><strong>Type:</strong> Stripe\Exception\InvalidRequestException</div>
<div><strong>Message:</strong> Must provide source or customer.</div>
我似乎无法获得错误的 JSON 表示形式。
我有一个 try/catch 块,但似乎没有什么不同。
try {
$charge = \Stripe\Charge::create([
"amount" => $total_amount * 100,
"currency" => "aud",
"customer" => $customer_id,
"description" => 'Payment for order ID #' . $request['orderID']
]);
} catch (\Stripe\Error\Card $e) {
// Handle "hard declines" e.g. insufficient funds, expired card, etc
// See https://stripe.com/docs/declines/codes for more
}
有什么想法吗?
【问题讨论】:
标签: php stripe-payments slim