Accept a payment - Create a PaymentIntent with PHP

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • Accepting a one-time payment with a custom form requires two steps. First, creating a PaymentIntent on the server. Second, confirming the payment intent on the client. It's also recommended that you handle fulfillment for a purchase when receiving a webhook notification of successful payment.
    In this video, you'll learn how to create a PaymentIntent on the server using PHP and how to setup a basic Webhook handler. For part two of this series to confirm a PaymentIntent using a variety of payment methods, watch one of the videos in the playlists for front end frameworks:
    HTML and JavaScript - • stripe-js
    React - • react-stripe-js
    iOS - • stripe-ios
    Android - • stripe-android
    If you'd like to learn how to create a PaymentIntent on the server in another server side language, consider watching one of these episodes:
    Ruby - • Accept a payment - Cre...
    Python - • Video
    Node.js - • Accept a payment - Cre...
    Java - • Accept a payment - Cre...
    Go - • Accept a payment - Cre...
    .NET - • Accept a payment - Cre...
    Resources
    Code: github.com/stripe-samples/acc...
    Documentation: stripe.com/docs/payments/paym...
    How intents work: stripe.com/docs/payments/intents
    Playlist: • stripe-go
    Table of contents
    00:00 Overview
    01:11 Setup the office hours sample
    01:45 Add route to create-payment-intent
    02:12 Create a basic PaymentIntent using the API with stripe-go
    02:45 Test the endpoint with cURL
    03:12 Accept payment method type and currency in request
    04:57 Handle errors
    05:48 Handle webhook notifications
    08:23 Add a config route for fetching publishable keys
    09:00 Recap and conclusion
    Presenter
    CJ Avilla, Developer Advocate at Stripe - / cjav_dev
    Support
    If you have a question, please feel free to reach out to our support team on Discord at stripe.com/go/developer-chat.
    Updates
    Sign up to stay updated with developer news: go.stripe.global/dev-digest
    Feedback
    If you have any feedback about this or other episodes, let us know: forms.gle/VjNqzRhotM2snYo88.
    #Stripe #Payments
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 26

  • @slavicakaraterzieva3257
    @slavicakaraterzieva3257 3 ปีที่แล้ว

    thanks for helping me integrate stripe to my web app. this step by step, from a scratch, playlist helped me a lot.

  • @darlingdarling8745
    @darlingdarling8745 2 ปีที่แล้ว

    thank you motta for giving well knowledge

  • @StripeDev
    @StripeDev  3 ปีที่แล้ว

    We're so glad to hear that! Feel free to reach out with any further questions.

    • @the-real-tridder
      @the-real-tridder 2 ปีที่แล้ว

      Yeah here's a question, where the eff does someone start!? why is the overview number 12 in the playlist? How is this 101? Stop paying people to comment, no one has looked at this playlist and gone "oh I know whats going on!"

    • @the-real-tridder
      @the-real-tridder 2 ปีที่แล้ว

      and where is the starter episode? you know, the 0-1 that I dare say EVERYONE would come here looking for?

  • @petsoukos
    @petsoukos 3 ปีที่แล้ว

    Are there any limits in payment intent creation? Because every time you refresh you just get a new secret.

  • @gio2156
    @gio2156 ปีที่แล้ว

    hey, thanks for the best api docs and tutorials! I have 1 question, if i make charge via backend (with $stripe->charges->create & $stripe->paymentIntents->confirm), would i be able to safely perform some actions after payment by checking paymentIntent status? Or it is safer to use webhooks, even if client side not involved in making charges?

    • @StripeDev
      @StripeDev  ปีที่แล้ว

      Hi Gio-thanks! For your question, can we clarify what you mean by "perform some actions after payment"?

  • @asifullah3050
    @asifullah3050 2 ปีที่แล้ว

    Thanks for this great tutorial, I created the payment using Payment Intent but it shows error that "That the customer has not entered their payment method", can you please help me how do I setup payment_method?

  • @anupsinghrana5735
    @anupsinghrana5735 2 ปีที่แล้ว

    Hey, Kindly guide/help me on how to refund the amount using paymentIntern stripe connected account in PHP.

  • @christianhabermann6527
    @christianhabermann6527 2 ปีที่แล้ว +2

    this is an incomplete tutorial, right? it's totally missing the part where it takes the customers data from the frontend. it feels just odd as this tutorial here doesnt even show a WORKING case of payment. I feel strongly irritated now.

  • @StripeDev
    @StripeDev  2 ปีที่แล้ว

    Hey Christian-you can find video tutorials with front end steps for accepting different payment types right here in this TH-cam playlist: th-cam.com/play/PLy1nL-pvL2M7EUdqARPiayuj5cjGMLCvM.html.

  • @abbesbahfir382
    @abbesbahfir382 ปีที่แล้ว

    I cannot find the code of this example. "stripe samples create developer-office-hours tutorial" shows "reference not found" error message but "stripe samples create accept-a-payment" with "payment-element" as integration is an equivalent example. In this latter, the activation of the local webhook manager causes continuous creation of payment intents on a single submit of the primary form. Can anyone tell me what is the cause and how to solve it ? Thank you.

    • @StripeDev
      @StripeDev  ปีที่แล้ว

      Hi Abbes! All code is included in the links in our description.

  • @KendraAndTheLaw
    @KendraAndTheLaw 2 ปีที่แล้ว

    What editor are you using? I want that.

  • @StripeDev
    @StripeDev  2 ปีที่แล้ว

    Hey Asif, thanks for your question. We need more information like how you created the PI, the request ID, if it was confirmed, the request ID of that confirm, etc. Mind emailing us at support@stripe.com or you can post your query on Discord here: discord.com/invite/stripe.

  • @sachendrakumar3343
    @sachendrakumar3343 2 ปีที่แล้ว +1

    How to add google pay and apple pay option in recurring payment in stripe with php

    • @StripeDev
      @StripeDev  2 ปีที่แล้ว

      Hey Sachendra! Here are a few links to guides that will help you:
      - stripe.com/docs/apple-pay?platform=web#recurring-payments
      - stripe.com/docs/google-pay
      These show how to integrate Apple pay and Google pay and how to set up recurring payments.

  • @bhaidar
    @bhaidar ปีที่แล้ว

    Great video, as usual. I have a confusion I hope you can help me with. We have two ways to accept payment on the client side using either Card Element or the new method of using Payment Element. On the server, to create a payment intent, you can pass the payment_method_types. I could use Payment Element on the client-side and while creating a payment intent I could specify payment_method_types => ['card']?

    • @StripeDev
      @StripeDev  ปีที่แล้ว

      Hey there-great question! You should be able to specify payment_method_types as "card" if you prefer, though keep in mind this is actually the default type for this parameter when it isn't otherwise specified. You can find more details on this here: stripe.com/docs/api/payment_intents/create.

    • @bhaidar
      @bhaidar ปีที่แล้ว

      @@StripeDev Basically, whether it's a card element or a payment element, in both cases, I could use the payment_method_types of the card?

    • @StripeDev
      @StripeDev  ปีที่แล้ว +1

      Yes, as long as you intend for it to be a card transaction, then you should be able to use the same parameter for PaymentIntent. You may just not see this on examples for Card and Payment Elements since it already defaults to "card" unless otherwise specified. A key difference between Card and Payment Elements is that Card Elements can only accept card payments, where Payment Elements can accept other payment methods as well. You'll also find more details on the differences here: stripe.com/docs/payments/payment-card-element-comparison.

    • @bhaidar
      @bhaidar ปีที่แล้ว

      @@StripeDev amazing! Thanks a lot for your reply. Im amazed how quick and efficient you are in helping out devs! I love the spirit.

  • @florisvandenberg7424
    @florisvandenberg7424 2 ปีที่แล้ว +1

    This tutorial is basically useless. It just tells you how to create a PaymentIntent. I can read how to do that on the docs page. What's confusing is what to do next. How do I input bank data (in case of ideal), how do i redirect the customer to his bank and how do I receive notification about a succesful (or failed) payment in the webhook? This is all very confusing to me. I also don't like being nudged into using the SDK. I'd rather write my own interface.

  • @mxd8
    @mxd8 3 ปีที่แล้ว

    unsubbed wtf