Aisha Badar
Aisha Badar

Reputation: 179

Paypal Express Guest Checkout forcing user to create account on paypal

I am facing an issue to provide Guest Checkout (Optional) feature to users. I have tried almost all the solutions on stackoverflow but still it is forcing user to create an account on paypal. My current site is based on laravel. On my old website which was based on Wordpress the guest checkout is working fine where I used a plugin but on my current website which is based on Laravel, the Guest Checkout Option is not working at all. I am using this plugin https://github.com/srmklive/laravel-paypal. I added few lines in src/Services/ExpressCheckout.php in setExpressCheckout function, so setExpressCheckout looks like this now:

    public function setExpressCheckout($data, $subscription = false)
{
    $this->post = $this->setCartItems($data['items'])->merge([
        'PAYMENTREQUEST_0_ITEMAMT'          => $data['total'],
        'PAYMENTREQUEST_0_AMT'              => $data['total'],
        'PAYMENTREQUEST_0_PAYMENTACTION'    => $this->paymentAction,
        'PAYMENTREQUEST_0_CURRENCYCODE'     => $this->currency,
        'PAYMENTREQUEST_0_DESC'             => $data['invoice_description'],
        'PAYMENTREQUEST_0_INVNUM'           => $data['invoice_id'],
        'NOSHIPPING'                        => 0,
        'SOLUTIONTYPE'                      => 'Mark',
        'LANDINGPAGE'                       => 'Billing',
        'USERSELECTEDFUNDINGSOURCE'         => 'CreditCard',
        'ADDROVERRIDE'                      => 1,
        'RETURNURL'                         => $data['return_url'],
        'CANCELURL'                         => $data['cancel_url'],
        'LOCALE'                            => $this->locale,
    ]);

    $this->setExpressCheckoutRecurringPaymentConfig($data, $subscription);

    $response = $this->doPayPalRequest('SetExpressCheckout');

    $response['paypal_link'] = $this->config['gateway_url'].'/webscr?cmd=_express-checkout&token='.$response['TOKEN'];

    return $response;
}

My old website paypal page looks like this, where user is not being forced to create a paypal account:

enter image description here

My current website paypal page look like this, where user have to join paypal.

enter image description here

Note: Paypal account on both the sites are same, so, if Guest Checkout is working for one website then it should work for another too.

Can anyone please help me what I am missing here. Your suggestions and help will be highly appreciated.

Thank You.

Upvotes: 0

Views: 774

Answers (1)

Himanshu Upadhyay
Himanshu Upadhyay

Reputation: 6565

you can try changing your cmd value which you are passing like given below:

$response['paypal_link'] = $this->config['gateway_url'].'/webscr?cmd=_cart&token='.$response['TOKEN'];

It will not ask to create account and user can checkout as a guest with paypal.

Upvotes: 0

Related Questions