Playing
01. Introduction and demo

Transcript

00:00
So let's go ahead and build a pay once for access app. What do we mean by this?
00:05
Well, let's head over to the members area of this app. You can see we're redirected straight back to dashboard. Basically, what we're going to do is implement a protected or multiple protected areas of an app where you have to pay once to get access to them areas.
00:22
So if you're looking to integrate this functionality into your app, this is going to guide you through everything that you need to do to get this working. Or if you just need a primer on how to use the Stripe Payment Intents API, then this is also going to guide you through that.
00:39
So we're, of course, using Stripe for the payments here, and we're going to be focusing on using the Payment Intents API for this. OK, so let's look at a full demo. We've already seen over here this members area, which has middleware to protect us.
00:54
If we head over to the database here, you can see that we have a column that just says member. At the moment, that's false. That middleware is protecting this particular route here. Now, we have this slash payments page here.
01:05
So if we just head over to this, you can, of course, name this anything. But this is going to be where we set up the Stripe Payment Intent API. We request a card. We go ahead and enter it.
01:16
And of course, as long as the payment is successful, we grant access to this app. And we do that via a webhook to then look up the payment intent and check that the payment was successful. And of course, we'll cover all of that through the course.
01:31
So let's go ahead and just enter in a fake card number in here and an expiry as well. So 24, 1, 2, 3, and just do 1, 2, 3, 4, 5. Let's go ahead and hit Make Payment. If this fails for any reason, we'll just see an error here.
01:45
But now we're redirected back over to the dashboard. And of course, you could flash a message here if you wanted to. But we can now go over to the Members area. And you can see we do have access.
01:53
So if we head back over to the database, you can see Member has been set to True. Now, all of this seems relatively straightforward. On the surface, it looks that way. But behind the scenes, the Payment Intent API within Stripe
02:06
can take a little bit of time to wrap your head around. And that's exactly why we're covering this in this course. So now that we've seen how this works, let's go ahead in the next episode, get a fresh Laravel app set up and ready to start building this in.

Episode summary

In this intro episode, we're kicking things off by building a pay-once-for-access app. What that means is users pay a single time, and once they do, they're granted access to certain protected areas of your application—like a members area. We start with a quick walkthrough so you can see exactly what we're aiming to build.

You'll get a sneak peek at the members area, which is currently locked down. Only users who've paid can get in, thanks to some middleware protection. We look under the hood at the database too, where we track whether someone is a "member" or not.

We then check out the payments page, where users can make a one-time payment using Stripe. After a successful payment (we demo this with a test card!), the system grants access, updates the database, and the user can jump straight into the protected area. All the magic happens via Stripe's Payment Intents API and a webhook to verify successful payments before granting access.

This video gives you a full demo of the finished feature so you know what we're building. Then, in the next episode, we’ll set up a fresh Laravel app and start breaking down the whole process step by step. If you've ever wondered how to protect app routes behind a paywall or wanted to see how Stripe's Payment Intents works in a real-world app, you're in the right place!

Episode discussion

No comments, yet. Be the first!