arthurvillar

arthurvillar

Member Since 2 Years Ago

Experience Points
40,130
Total
Experience

4,870 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
254
Lessons
Completed
Best Reply Awards
22
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 9
40,130 XP
May
05
2 months ago
Activity icon

Awarded Best Reply on Stripe Issue: Catching Any Wrong/invalid Card Errors Using Customer Create For Subscriptions With Stripe

Problem solved! For anyone running into this same problem, I realized that the trial period for the customer was not applying until I added 'trial_from_plan' => true in the array sent to create the customer. Now that method looks like this:

            $customer = Customer::create([
                'description' => auth()->user()->full_name,
                'email' => auth()->user()->email,
                'source' => $request->stripeToken,
                'plan' => $plan,
                'trial_from_plan' => true
            ]);   

This now works as expected and Stripe is sending the errors when a card has an expired date, wrong CVC and so on.

Activity icon

Replied to Stripe Issue: Catching Any Wrong/invalid Card Errors Using Customer Create For Subscriptions With Stripe

Problem solved! For anyone running into this same problem, I realized that the trial period for the customer was not applying until I added 'trial_from_plan' => true in the array sent to create the customer. Now that method looks like this:

            $customer = Customer::create([
                'description' => auth()->user()->full_name,
                'email' => auth()->user()->email,
                'source' => $request->stripeToken,
                'plan' => $plan,
                'trial_from_plan' => true
            ]);   

This now works as expected and Stripe is sending the errors when a card has an expired date, wrong CVC and so on.

Activity icon

Started a new Conversation Stripe Issue: Catching Any Wrong/invalid Card Errors Using Customer Create For Subscriptions With Stripe

I am starting to create an API with Stripe for a web-app that offers memberships.

I cannot use Cashier because the web-app's server also serves an iOS app that has in-app purchases subscriptions and the entire system is already in place.

The issue is that when I fetch the user's card information and create the Customer on Stripe, that customer still gets created even when I use a test card that fails for any reason.

On Stripe's end, it does indicate that the charge failed and the payment is incomplete, but I would rather catch that error and return to the user asking them to fix their mistake before any information is actually saved on Stripe or on our server (which is what usually happens).

On the course here "How to Accept Payments" Jeff Way goes through catching such error but it looks like now Stripe is not throwing these errors anymore and lets the user through regardless.

Here is my controller that expects to catch the error but does not:

    public function purchase(Request $request)
    {
        Stripe::setApiKey(config('services.stripe.secret'));

        try {
            $customer = Customer::create([
                'description' => auth()->user()->full_name,
                'email' => auth()->user()->email,
                'source' => $request->stripeToken,
                'plan' => 'my-plan'
            ]);   
        } catch (\Stripe\Exception\CardException $e) {
	    // This is what I want to happen but never does.
            return back()->with('error', $e->getError()->message);
        }
    	
        return $customer;
    }

I expect the catch block to trigger but it never does. Any ideas? Did Stripe change the way they handle such issues, or am I missing something?