My restaurant uses Laravel Cashier and Stripe.
I want to use multiple payment methods supported by Stripe for my clients, but I can't find any information in the Laravel Cashier documentation about using multiple payment methods in Stripe.
The Accept Payments document in the Stripe documentation is exactly what I need. Is there a way to implement the method described in this document with Laravel Cashier?
P粉4712073022023-12-12 11:01:41
SetupIntent created to collect payment methods accepts Cards仅。此外,前端也仅使用 Laravel Cashier 文档中的 Card Element,用于收集卡信息。
by defaultTo accept other payment method types, you first need to use other payment_method_types on the server and then pass the client key to the payment element instead of the card element for rendering. The payment element allows one or more payment methods. For more information you can refer to the documentation here: https://stripe.com/docs/payments/save-and-reuse
Please note that not all payment methods support SetupIntent (for future use). You can refer to the documentation here to learn about payment methods that support SetupIntent: https://stripe.com/docs/ payments/ payment-methods/integration-options#additional-api-supportability
P粉0717437322023-12-12 09:37:23
This requires running php and js scripts for striping,
its referencehere
You first need a setup intent, which you must use to call
return $user->createSetupIntent();
And access the value on the front end. On your card/payment page you have to set stripe js card element. Then capture and process the card element as shown in the following example (using axios)
const { setupIntent, error } = await stripe.confirmCardSetup(your_SETUP_INTENT, { payment_method: { card: your_card_object, billing_details: { name: 'Card Name' } } }) if (error) { console.log(error) } else { const { data } = await axios.post('/api/payment-method', { card: setupIntent.payment_method }) }
Once the stripe request is successful, you will get the payment method ID, which you can push back to your server, as in the example above, and then attach the payment back to that user by calling addPaymentMethod
< /p>
$user->addPaymentMethod( $request->input('card) );