This episode is for members only

Sign up to access "Build a Pay Once For Access App" right now.

Get started
Already a member? Sign in to continue
Playing
13. Protecting the payment page with middleware

Transcript

00:00
This isn't strictly necessary but it would be really nice to prevent an already paid user from accessing this payment page again.
00:09
So ideally we wouldn't want them to pay twice for this, we wouldn't want them to land on this page. So what we're actually going to do is we're going to create, if we come over to our middleware, an opposite method to redirect if not member
00:23
and we're going to go ahead and create a piece of middleware to redirect to user if they are a member. So if we come over to our terminal here and just create out some more middleware, let's call this redirect if member and what we can do is pretty much grab this here and do the same thing over and redirect if member but if they are a member
00:50
we're going to redirect them over to the dashboard or we could redirect them to the members page. So let's go over to our payment index controller and we already have our middleware up here for auth, we're also going to use redirect if member, there we go, and now if we are a member we just get redirected on that payments page so we can't make another payment.
15 episodes1 hr 11 mins

Overview

Let's do payments right with the Stripe Payment Intent API, and build an app where customers can pay to access a members area.

We'll cover setting up a Payment Intent, process payments correctly with authorization, handle declines, and securely respond to a Stripe webhook to upgrade a member.

This course is for you if:

  • You want to process payments to upgrade customers for access
  • You need to learn how to properly process one-off payments with Stripe
  • You need a refresher on the Payment Intents API
Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Comments

No comments, yet. Be the first to leave a comment.