我正在尝试使用Elements及其API为新的SCA Stripe集成编写测试。我被困在测试PaymentIntent
的手动确认.
我能够创建付款意图。通常它会返回一个client_secret
,然后与 Stripe 一起使用.jshandleCardAction()
然后返回一个PaymentIntentID,我可以使用PaymentIntent::retrieve()
进行确认。
由于我的测试在 PHP 端运行,因此我无法触发handleCardAction()
,如果我跳过该步骤并使用client_secret
,我会收到以下异常:
条带\异常\无效请求异常:没有这样的payment_intent:pi_1FFIp5HU59FHbUqraBNXk9Br_secret_agKRuHJx4y83RFnjpKkGmd29W
如何在不使用 Stripe.js 的情况下获取可供确认的支付意向ID?
显然我可以使用
$intent = PaymentIntent::create([
'payment_method' => 'pm_card_threeDSecure2Required',
'amount' => 1000,
'currency' => 'USD',
'description' => 'blabla',
'confirmation_method' => 'manual',
'confirm' => true,
]);
// $intent->id can be used with PaymentIntent::retrieve()