rabol

rabol

Member Since 4 Years Ago

Experience Points
27,610
Total
Experience

2,390 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
257
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 6
27,610 XP
Nov
30
1 month ago
Activity icon

Replied to Cashier AddPaymentMethod Does Not Update Card_brand

It's about liking your answer, the point is that I was trying to figure out the behaviour of a method.

The method name is hasPaymentMehod, and the doc say that it can be used to check if a billable model have a payment method.

Even after adding a payment method, using addPaymentMethod() the hasPaymentMethod() returns false.

I have reported it at github and it will be fixed

A workaround could be like this:

in the model where you use the Billable trait:

        use Billable {
            hasPaymentMethod as traithasPaymentMethod;
        }

    public function hasPaymentMethod()
    {
        return (bool) $this->paymentMethods()->count();
    }
Nov
29
1 month ago
Activity icon

Replied to Cashier AddPaymentMethod Does Not Update Card_brand

I'm sorry, but I do not see the example, you simply

$user->updateDefaultPaymentMethod($user->paymentMethods()->first()->id);

which is a 'trick'

My point is that haPaymentMethod() should return true if the user have any payment methods, and then i should use defaultPaymentMethod() to get the default payment, and if there is no default payment method, let the user select one of the payment methods on his profile

Activity icon

Replied to Cashier AddPaymentMethod Does Not Update Card_brand

yes, I know that I can 'trick' the system, but I think that the user should be in control of which payment method is the default and not the first.

If the user 'delete' his default card in Strip, but still have 2-3-4 other payment methods, then I should get theses and allow the user to select which to use and if there is more than one, then hasPaymentMethod() should not return false

from the Documentation:

"To determine if a Billable model has a payment method attached to their account, use the hasPaymentMethod method:"

Activity icon

Started a new Conversation Cashier AddPaymentMethod Does Not Update Card_brand

Hi

I have been struggling with making the latest version of Cashier work.

My flow is like this: User select a 'plan' Check if the user is a stripe user - check if strip_id is filled on the user, if not create a stripe customer

check to see if the user have payment methods - auth()->user()->hasPaymentMethod()

if the user does not have a payment method, then show a form and capture the 'payment method' The payment method is saved like this: auth()->user()->addPaymentMethod($paymentMethod)

then I redirect the user to the plans page as now we should have a valid payment method - It even shows up in the Stripe Dashboard

but... auth()->user()->hasPaymentMethod() return 'false'

 public function hasPaymentMethod()
    {
        return (bool) $this->card_brand;
    }

the card_brand is never filled when calling the addPaymentMethod. card_brand is only filled in fillPaymentMethodDetails(), and the fillPaymentMethodDetails() method is only called when one update the default payment method

So my question is: What do I need to do to make the hasPaymentMethod() working ?

Nov
28
1 month ago
Activity icon

Replied to How To Use Cashier V10 In Laravel 6

One small problem I see with your version is that the credit card is not validated and you say that it does not show up in the Stripe dashboard. The version i have ensure that the credit card is valid and it shows up on the customer in Stripe.

But this part is only a small piece in the puzzle.

I still need to do the actual payment.

And I need to figure why the Vue.js screw up the call to Strip to validate the card

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

and I had to 'disable' some Vue things

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

Look at this: https://laracasts.com/discuss/channels/general-discussion/no-such-thing-as-a-dumb-question

Then in my controller i have this:

        $paymentMethod = $request->input('stripePaymentMethod');
        $user = auth()->user();
        $user->addPaymentMethod($paymentMethod);
        return redirect(route('home'));
Activity icon

Replied to How To Use Cashier V10 In Laravel 6

hmmm... Nope, nothing happens when I press the pay button

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

For some reason i do not even get anything printed in the console

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

I got one step closer, I did a self-signed SSL certificate

I now have the 'correct' Credit card input control

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

Here is an important note from the Strip documentation:

"When you use Elements, all payment information is submitted over a secure HTTPS connection. The address of the page that contains Elements must also start with https:// rather than http://. You can test your integration without using HTTPS, and enable it once youre ready to accept live charges. For more information about getting SSL certificates and integrating them with your server to enable a secure HTTPS connection, see our security documentation."

Could it be that our 'elements' ar not rendered when using http?

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

@nakov Here is some very specific question: This is from the documentation, but it does not work.

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Add payment method</div>

                <div class="card-body">
                @if($errmsg)
                    <div class="row">{{ $errmsg }}</div>

                @endif
                <div class="form-group row">
                    <input id="card-holder-name" type="text">
                </div>
                <div class="form-group row">
                    <!-- Stripe Elements Placeholder -->
                    <div id="card-element"></div>
                    <button id="card-button" data-secret="{{ $intent->client_secret }}">Update Payment Method</button>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@push('after-scripts')
<script>
    const stripe = Stripe('{{config('cashier.key')}}');

    const elements = stripe.elements();
    const cardElement = elements.create('card');

    cardElement.mount('#card-element');

    const cardHolderName = document.getElementById('card-holder-name');
    const cardButton = document.getElementById('card-button');
    const clientSecret = cardButton.dataset.secret;

    cardButton.addEventListener('click', async (e) => {
        const { setupIntent, error } = await stripe.handleCardSetup(
            clientSecret, cardElement, {
                payment_method_data: {
                    billing_details: { name: cardHolderName.value }
                }
            }
        );

        if (error) {
            // Display "error.message" to the user...
            //alert('error');
            console.log('error');
        } else {
            // The card has been verified successfully...
            console.log('ok');
        }
    });
</script>
@endpush

There is no error messages in the console, and the 'input' is not transformed into a 'credit card' entry field

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

@geser I'm using Homestead on a Mac so I have slightly different steps

  1. Create a new site in Homestead.yaml
  2. homestead ssh
  3. cd code
  4. laravel new cashier
  5. cd cashier
  6. composer require laravel/ui --dev
  7. composer require barryvdh/laravel-debugbar --dev
  8. php artisan ui vue --auth
  9. edit your .env for DB
  10. npm install && npm run dev
  11. composer require laravel/cashier
  12. php artisan migrate
  13. edit env to add strip keys and cashier currency
  14. add the Billable trait uo the User Model
  15. Edit RegisterController.php with $user->createAsStripeCustomer(); in function create()
  16. php artisan make:controller AddPaymentMethodController
  17. in the index method, check to see if the user have a stripe_id, if not call $user->createAsStripeCustomer();
  18. Create AddPaymentMethod.blade.php with the Stripe payment method form from docs
  19. Update your Routes/web.php and test

I have created a github repository : https://github.com/rabol/laravel-cashier-demo There is no code yet, but I will do it tomorrow and continue to update with progress

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

Thanks, I'm reading old tutorial and comparing with the stripe doc's on the flow and it looks like a lot of things have changed

e.g. that one have to create a 'session' etc. to be SCA compliant in EU

I'm making a lot of notes and when done I'll publish the result

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

And making fun of people is not nice... Your 'joke' is tasteless and utterly childish

and does not work

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

Please read the subject and the very first line of the post, thanks

Activity icon

Replied to How To Use Cashier V10 In Laravel 6

Sorry, but the link you shared is not even close to explaining how to use Cashier end-2-end

If you start from the top of the documentation and then start to code as you read, there is no clear flow, there are a snippet of 'html' get the card holder name and display a button, and then some JS code that is not complete.

This is a 'example' of how to use Cashier in Laravel 5, and is more what I am looking for https://www.itsolutionstuff.com/post/laravel-5-stripe-example-using-laravel-cashier-from-scratchexample.html

Activity icon

Started a new Conversation How To Use Cashier V10 In Laravel 6

Hi

Where can I find a good tutorial on how to use Cashier v10 and Laravel 6

The latest documentation is not very clear and the 'samples' are not working or is not very clear on how to use

Thanks

Nov
26
2 months ago
Activity icon

Commented on What Is Spark?

Hi

How is the current version of Spark compared to the version in the video?