Search for PHP example new stripe “checkout” integration stripe-php

前端 未结 3 1194
孤城傲影
孤城傲影 2021-02-09 04:31

What do I have to change in my code to immigrate from legacy stripe checkout to the new checkout?? I am confused with their wording. And most examples I find are old (2015-1016.

3条回答
  •  感情败类
    2021-02-09 05:07

    With the new SCA regulations coming in as you mentioned in your comment, you need to use Payment methods and Payment intents now.

    Basically from taking a look at your sample code you will need to rewrite pretty much everything (if you haven't already)

    Their current docs are here -> https://stripe.com/docs/payments/checkout

    The reason for Payment Intents and Payment methods is due to SCA - https://stripe.com/docs/strong-customer-authentication

    They have a migration guide too which can be found on the side bar.

    However from their examples this is how you would create your new payment intent

    $intent = \Stripe\PaymentIntent::create([
        'amount' => 1099,
        'currency' => 'gbp',
    ]);
    

    Here is also their guide for migrating from the charges API - it has a tab for stripe.js V2 if you've been using it https://stripe.com/docs/payments/payment-intents/migration

提交回复
热议问题