Trouble setting up a subscription with Laravel 5.8 / Cashier / Stripe

前端 未结 6 1749
暖寄归人
暖寄归人 2020-12-30 16:38

I followed this tutorial step by step: https://appdividend.com/2018/12/05/laravel-stripe-payment-gateway-integration-tutorial-with-example/

However, when I go to tes

6条回答
  •  时光说笑
    2020-12-30 16:41

    Using that tutorial you need to use Laravel Cashier version prior to version 10 that stopped using Stripe Tokens.

    For new projects I suggest that you use Laravel Cashier 10 and Stripe Elements as you would otherwise end up having to do some serious refactoring in the near future when the old API gets depreciated.

    As Laravel Cashier 10 has just been released there are not much info other than the original docs. I just got a project up and running using it and am happy to answer any questions if you decide to go that route.

    The new process is basically:

    1. Create a setupIntent
    2. Collect payment information and CC using Stripe Elements
    3. Send it together with the setupIntent to Stripe and receive the payment_method using the stripe.handleCardSetup().
    4. Use the payment_method instead of the depreciated token when setting up a new subscription.
    5. Have your Stripe Webhook handle the payment/subscription updates.

提交回复
热议问题