Paypal Integration in Laravel with verify email address

B L Praveen posted 6 months ago

I am getting following error message when creating user in Registration Controller

Argument 1 passed to Illuminate\Auth\SessionGuard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, null given

I have two type of user paid and free .Where do I need to redirect to PaypalAgreemnt while user is trying to register. If I return User it is verfiying the user email

class RegisterController extends Controller

   protected function create(array $data)
     if(isset($data['type'])  && $data['type'] == 'paid' ) {
        Session::put('type', $data['type']);
        Session::put('email', $data['email']);
        Session::put('password', $data['password']);
        $plan_id = 'P-4C095357DP980872FT2QOCTA';
        $agreement = new PaypalAgreement();

    } else {
        return User::create([
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
class PaypalAgreement extends Paypal
public function create($id) {

    return redirect($this->Agreement($id));

protected function Agreement($id): string
    $agreement = new Agreement();
    $agreement->setName('Base Agreement')
        ->setDescription('Basic Agreement')
    $plan = $this->Plan($id);
    $payer = $this->Payer();
    $ShippingAddress = $this->ShippingAddress();
    $agreement = $agreement->create($this->apiContext);

    return $agreement->getApprovalLink();
Pardeeptech replied 6 months ago

I think , this error is because your are returning a string and the class is expecting an instance of Authenticatable.

Create a middleware that checks if the username is a 'Slug' Create () method when validation passes
clean up the AuthController by removing the slugCheck method

I suggest you , to follow this article for more information let me know if you face any problem again

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us