Back Button PHP

Billing With Stripe

At some point or another, every web developer will find himself in the position of needing to accept financial data. This isn't to be taken lightly. What if, instead, we could offload the handling of credit card data to a third party service?

Intermediate
Difficulty
5 episodes
47:30 mins
Start Series
Notification bell This series has been archived. A series is marked as archived when the content is no longer up-to-date or relevant to most viewers.
  • Latest Episode: Customers and Exceptions

  • Like this series? Share the love!

    1. Run Time 6:02
      Free

      In this opening episode, we'll take things easy and browse the Stripe dashboard, as we review such things as API keys, plans, and coupons. To finish up, we'll begin the inital prep work of installing Stripe's PHP package through Composer.

    2. Run Time 8:23

      Let's next move on to storing the test and live versions of our API keys within a configuration file. We'll also discuss forms, and why it's so important to never include the name attribute for financial-specific inputs.

    3. Run Time 9:14

      Let's now move on to the JavaScript portion of the series. We need to fetch the user's data from the form, and submit an AJAX request to Stripe's servers, at which point, if the card is billable, a unique one-time token will be returned.

    4. Run Time 14:22

      We're finally at a point where we can charge the user, using the unique token that was returned to us from the AJAX request.

    5. While one-time charges have their place, often, you'll find that it's preferable to instead create customers. This way, in the future, should you need to bill the user again, you only need to reference their customer id.

      Download the source for this series from GitHub.