This episode is for members only

Sign up to access "Build a File Marketplace with Laravel" right now.

Get started
Already a member? Sign in to continue
Playing
07. Verifying if payouts are enabled

Episodes

0%
Your progress
  • Total: 3h 32m
  • Played: 0m
  • Remaining: 3h 32m
Join or sign in to track your progress

Transcript

00:00
To verify that payouts are enabled on this page, we need to hit the Stripe API, grab that user, and then check if payouts are enabled. That means that Stripe is happy with all of the details that
00:12
have been given. This could be false. And if it is false, then the users will have to go back through the process,
00:18
fill in any missing information, or whatever else they need to do before being redirected back over here again. So let's go ahead and grab the user, or the account more like, from the API using our Stripe wrapper.
00:32
So accounts, and this time we're going to go ahead and say retrieve. We spell that properly. And we're going to go ahead and pass in the user's Stripe ID
00:41
in here, which we can grab directly from the authenticated user. So that is Stripe account ID. You can pass other options through to here as well.
00:50
So we'll just leave an empty array here, but we're not going to need them for now. Okay, so now what we can do, let's just die dump on this response
00:57
and just see what we get here. So let's just give this page a refresh again. And you can see all of the information with all of the details that I've entered
01:05
through that onboarding process. Now, the one thing we want to make sure is enabled our payouts. You can see we've got this payouts enabled property
01:13
just here, and that is set to true, because I've filled in all of the information required for payouts to be sent to me when I sell products. So now what we need to do is just update the current user
01:24
with that value within that payouts enabled, or Stripe account enabled property that we have on our model. So Stripe account enabled, remember that's what we added just in here,
01:37
and we can go ahead and set that to the value we get back from the API under payouts enabled. You can, of course, call this something different if there's any confusion between the two,
01:48
but that should be enough for this to work nicely. Now, once that happens, we're going to go ahead and redirect the user back to the dashboard.
01:57
And of course, if they haven't been enabled, this is then going to forward them back up to the onboarding flow, where they're going to have to go back through the process.
02:05
So effectively, we're just keeping the user in that onboarding flow until this value is true. So if we head back over and give this page a refresh, that should verify my account.
02:15
Of course, that will have been updated in the database just here to true. And now we can access our dashboard, start creating products, and start selling.

Episode summary

In this episode, we focus on how to verify if Stripe payouts are enabled for a user. This is an important step—if payouts aren’t enabled, the user won’t be able to receive money from sales.

First, we hit the Stripe API to retrieve the current user's account information. We check the payouts_enabled property on the account to see if everything is set up correctly—meaning Stripe has all the information it needs.

If payouts_enabled is false, the user needs to go back through the onboarding process and fill in any missing details. If it’s true, we update the corresponding value in our own user model (usually called something like stripe_account_enabled) to match.

After updating, we redirect the user appropriately: if payouts are enabled, they get sent to the dashboard and can start selling products. If not, they’re sent back through onboarding until everything is squared away. The episode is all about making sure our app is in sync with Stripe so users have the right access at the right time!

Episode discussion

No comments, yet. Be the first!