Тёмный

Accept a payment with the Payment Element using PHP 

Stripe Developers
Подписаться 29 тыс.
Просмотров 13 тыс.
50% 1

In this episode, you'll learn how to accept a one-time payment with a custom form using PHP on the server and the Stripe Payment Element on the client. The Payment Element enables you to collect several different payment method types from cards and bank accounts to wallets and buy-now-pay-later payment methods.
Presenter
CJ Avilla - Developer Advocate at Stripe - / cjav_dev
Chapters
00:00 Introduction
01:37 Install a sample with the Stripe CLI
04:00 Enable payment methods in the dashboard
05:06 Overview of payment flow
05:31 Create payment intent on the server
08:00 Collect payment details on the client
11:22 Submit payment details to Stripe
13:58 Build a confirmation page
16:19 Handle webhooks and post-processing events
19:49 Test your integration with Stripe test cards
21:15 Conclusion
Resources
Accept a payment - stripe.com/doc...
PaymentIntent API reference - stripe.com/doc...
Learn all about webhooks - stripe.com/doc...
Support
If you have a question, please feel free to reach out to our support team on Discord at stripe.com/go/...
Updates
Sign up to stay updated with developer news: go.stripe.glob...
Feedback
If you have any feedback about this or other episodes, let us know: forms.gle/VjNq...
#stripe #payments #php #payment_element #integration

Хобби

Опубликовано:

 

14 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 35   
@timurgafforov8856
@timurgafforov8856 6 месяцев назад
Thanks a lot for the tutorial. Though, it would be nice to have this exact code you've written downloadable. I know there are enough samples provided in GitHub, but it really simplifies when you just have such step-by-step instructions for a downloadable code. One wouldn't have to look for chunks of required code or type them manually. Not critical, but, I think, a valid suggestion.
@senju31
@senju31 19 дней назад
I agree.
@StripeDev
@StripeDev Год назад
Hey there-good question! You can take a look at how to create charges which will generate a charge ID here: stripe.com/docs/api/charges/create. You'll also find more information on how to retrieve charges using the charge ID a bit further down.
@tiydosoft
@tiydosoft 7 месяцев назад
Hi there, This tutorial is really helpfull. I need to know one more think. I want to set the customer name but they maybe a guest user! So how can I do this? is there any parameter to add the guest customer name?? $paymentIntent = $stripe->paymentIntents->create([ 'amount' => $amount, 'currency' => $currency, 'automatic_payment_methods' => ['enabled' => true], // 'customer' => $customer, 'description' => $description, 'receipt_email' => $receipt_email, 'metadata' => [ 'u_id' => $u_id, 'o_id' => $o_id, ], ]); Thank you!
@thesigmasystems
@thesigmasystems 4 месяца назад
Perfect
@jamesr2408
@jamesr2408 11 месяцев назад
@17.49 the webhook trigger was successful, and the results are evident in the terminal. When I redirect the return_url to webhook.php, upon payment, I get the error: {"error":"Unable to extract timestamp and signatures from header"}. It is unfortunate, that the demo does not show the webhook.php in action. But all the same, thanks a ton for sharing this tutorial.
@MattBarraud
@MattBarraud 8 месяцев назад
This is a great tutorial, thank you - I do have a question, how do I also add the users name, email and a short description of the payment? I believe I need to create the customer first - then the intent? How does that work in this workflow?
@StripeDev
@StripeDev 8 месяцев назад
Hi Matthew-this tutorial specifically covers one-time payments. If you need to add a customer for recurring payments, you can do so through the API or the Dashboard: stripe.com/docs/billing/customer. You might find our documentation on getting started helpful for setting up this workflow: stripe.com/docs/payments/accept-a-payment.
@sensingturtle
@sensingturtle 11 месяцев назад
This was a fantastic tutorial. Thank you so much :)
@chrispaul4090
@chrispaul4090 Год назад
Regarding currencies, how do I enable multiple currency option?
@StripeDev
@StripeDev Год назад
Hi Chris, have a look at our multiple currency doc here: stripe.com/docs/connect/currencies. Any further questions, feel free to get in touch using support.stripe.com. Thanks.
@jamesr2408
@jamesr2408 11 месяцев назад
I have test-mode pair of publishable and secret keys, but where to get the webhook secret? Is it generated when creating endpoints? Would that be in test mode or the live? Also in the video, the publishable and secret keys, are in quote marks as in Strings, but not in the generated code.
@StripeDev
@StripeDev 11 месяцев назад
We'd be happy to explain this further. Feel free to chat with us on Discord at stripe.com/go/developer-chat
@jamesr2408
@jamesr2408 11 месяцев назад
@@StripeDev Thanks for the discord link. I will use it in the near future. But for now, having ./stripe login done, the regenerated the started project, and .env was properly populated with the keys in quote marks. As a bonus, the webhook key was there too. THANKS AGAIN.🙂
@aliyufari
@aliyufari 10 месяцев назад
Great, but how can I add input to the form to collect user email and so on. And how to handle that in the back end.
@StripeDev
@StripeDev 10 месяцев назад
Hey there-great question! Could you please elaborate on this so that we can better answer your question?
@StripeDev
@StripeDev 10 месяцев назад
So, we dug a little deeper from what we could grasp out of your question. The email address mentioned here: stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails-email, if set to `auto` will only show as an input field when the PaymentMethod requires collecting it i.e. it will not always be displayed as an input field. What you can try is implementing the input field yourself and passing that in as part of the billing_details when confirming the PaymentIntent or SetupIntent. If you're implementing your own input field to collect the email address, you'll likely want to set it such that the Payment Element never collects the email. Alternatively, if you're willing to integrate with Link, you can take a look at this guide: stripe.com/docs/payments/link/add-link-elements-integration?link-integration-type=collect-email&defaultValues-integration-type=same#design-your-integration.
@fustibal
@fustibal Год назад
My customer sells tickets in the US for us events and sells tickets in Mexico for MX events. Will the exchange rate be done automatically to dollars if a ticket is sold in Mexico?
@StripeDev
@StripeDev Год назад
Hey Mario-are you speaking about Automatic Currency Conversion: support.stripe.com/questions/automatic-currency-conversion-pricing? Otherwise, this doc has more information about currency conversions: stripe.com/docs/currencies/conversions.
@fustibal
@fustibal Год назад
@@StripeDev Yes, this makes sense. What are the requirements to have an elegible account to have ACC enabled?
@StripeDev
@StripeDev Год назад
This feature is currently limited to beta users, but you can enter in your email at the bottom of this page if you're interested in participating: stripe.com/docs/payments/checkout/present-local-currencies#:~:text=Automatic%20currency%20conversion%20allows%20you,needing%20to%20update%20your%20integration.
@fustibal
@fustibal Год назад
@@StripeDev Thank you for the fast answers.
@riddhipanchal9141
@riddhipanchal9141 Год назад
Hello, can you guide how can we set Google pay instead of cards ?
@StripeDev
@StripeDev Год назад
Hello there. Happy to help you with that. After activating Google Pay on your dashboard here: dashboard.stripe.com/settings/payment_methods, you can follow the steps on this document to set this payment method to your website: stripe.com/docs/google-pay.
@nnnkgjj
@nnnkgjj Год назад
can u make video on how to change charge to intent
@StripeDev
@StripeDev Год назад
Hey T. We will certainly consider doing another video about it. For now, you can find information on changing a Charge to a Payment Intent in the official Stripe documentation: Payment Intents API: stripe.com/docs/payments/payment-intents Confirm a Payment Intent: stripe.com/docs/payments/payment-intents/quickstart#confirm-payment-intent Capture a Payment Intent: stripe.com/docs/payments/payment-intents/quickstart#capture In general, the Payment Intents API is designed to replace the Charges API, so you might also find it helpful to review the following resources for background information: Migrating to Payment Intents: stripe.com/docs/payments/payment-intents/migration Charge API vs. Payment Intents API: stripe.com/docs/payments/payment-intents/migration/charges
@alpachino468
@alpachino468 9 месяцев назад
Here's one for you: Using the API, I can get the payment_intent , and I can also get its associated charge for a successful purchase completed via the Stripe Hosted payment url. What I can't do is get the product that either the intent or the charge are associated to - how in the world do I get which charge or intent is associated to a product?
@StripeDev
@StripeDev 9 месяцев назад
Hi there, you can do this by retrieving the Session and using expansion stripe.com/docs/expand, to include the 'line_item': stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items. You can also take a look at this doc for more context: stripe.com/docs/api/checkout/sessions/retrieve.
@alpachino468
@alpachino468 9 месяцев назад
@@StripeDev Awesome, thanks for pointing me in the right direction ❤
@StripeDev
@StripeDev 9 месяцев назад
Happy to help!
@bmtamim7818
@bmtamim7818 Год назад
I don’t want to redirect them. Just want the charge id for the backend. How can I do this? Note: we are using stripe api. We took card data and send to srtipe. In test mood its work. But tomorrow we will live our application and today we just put the live key. And saw stripe sucks. They publish new rule we can't send raw card details. Okay perfect. This message should be with test too. So we aware and took necessary step erliery. But they didn’t and we have yo launch it tomorrow and we got this error..now I want to add stripe element but its want redirect url. Our system can't deal with this within one day. So, Stripe put us in trouble.
@user-yn8tc8ke3f
@user-yn8tc8ke3f Год назад
Can you share vscode theme name? :)
@user-yn8tc8ke3f
@user-yn8tc8ke3f Год назад
and font plus
Далее
Accept a payment with the PaymentElement using Node.js
24:16
Webhook helpers in stripe-php
18:57
Просмотров 10 тыс.
Accept a payment - Create a PaymentIntent with PHP
13:38
Mettre en place un paiement via Stripe Checkout & PHP
31:45
Making requests with stripe-php
30:37
Просмотров 9 тыс.
Introduction to the Stripe CLI
34:19
Просмотров 57 тыс.
Accept a card payment with Stripe.js
8:39
Просмотров 36 тыс.