【问题标题】:Testing manual confirmation of Stripe's PaymentIntent测试手动确认 Stripe 的 PaymentIntent
【发布时间】:2019-09-05 11:16:08
【问题描述】:

我正在尝试使用 Elements 及其 API 为新的 SCA Stripe 集成编写测试。我一直在测试PaymentIntent 的手动确认。

我能够创建 PaymentIntent。通常它会返回一个client_secret,然后与 Stripe.js handleCardAction() 一起使用,然后返回一个我可以使用PaymentIntent::retrieve() 确认的PaymentIntent id。

由于我的测试在 PHP 端运行,我无法触发 handleCardAction(),如果我跳过该步骤并使用 client_secret,我会收到此异常:

Stripe\Exception\InvalidRequestException : 没有这样的 payment_intent: pi_1FFIp5HU59FHbUqraBNXk9Br_secret_agKRuHJx4y83RFnjpKkGmd29W

如何在不使用 Stripe.js 的情况下获得可供确认的PaymentIntent ID?

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    显然我可以使用

            $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()
    

    【讨论】:

      猜你喜欢
      • 2020-04-17
      • 2020-10-31
      • 2021-01-22
      • 2021-02-04
      • 2020-04-23
      • 1970-01-01
      • 2019-11-20
      • 1970-01-01
      • 2021-02-27
      相关资源
      最近更新 更多