【发布时间】:2022-08-17 01:09:29
【问题描述】:
我正在处理stripe.com/docs/.../upgrade-to-handle-actions(和stripe.com/docs/.../accept-a-payment-synchronously)上的STRIPE 支付意图示例,并且已经到达了他们的generateResponse() 代码中“任何其他状态都将是意外的,所以错误”的部分
function generateResponse($intent) {
if ($intent->status == \'succeeded\') {
// Handle post-payment fulfillment
echo json_encode([\'success\' => true]);
} elseif ($intent->status == \'requires_action\') {
# Tell the client to handle the action
echo json_encode([
\'requiresAction\' => true,
\'clientSecret\' => $intent->client_secret
]);
} else {
// Any other status would be unexpected, so error <------------------
echo json_encode([\'error\' => \'Invalid PaymentIntent status\']);
}
}
但是我使用“资金不足”测试卡“4000008260003178”收到了“requires_confirmation”,我不确定我应该如何回应;我的代码可以在methodfish.com 上查看和运行。
标签: stripe-payments