srmklive / laravel-paypal

Laravel plugin for processing payments through PayPal.
https://laravel-paypal-demo.srmk.info/
MIT License
1.05k stars 316 forks source link

Class "Srmklive\PayPal\Services\ExpressCheckout" not found #607

Closed Manager-Singh closed 8 months ago

Manager-Singh commented 9 months ago

Class "Srmklive\PayPal\Services\ExpressCheckout" not found

I use code like that

and use at top of my controller

use Srmklive\PayPal\Services\ExpressCheckout;

$data['items'] = array_map(function ($item) use($cart) { $name=Item::where('id',$item['product_id'])->pluck('name'); return [ 'name' =>$name , 'price' => $item['price'], 'desc' => 'Thank you for using paypal', 'qty' => $item['quantity'] ]; }, $cart);

    $data['invoice_id'] ='ORD-'.strtoupper(uniqid());
    $data['invoice_description'] = "Order #{$data['invoice_id']} Invoice";
    $data['return_url'] = route('payment.success');
    $data['cancel_url'] = route('payment.cancel');

    $total = 0;
    foreach($data['items'] as $item) {
        $total += $item['price']*$item['qty'];
    }

    $data['total'] = $total;
    if(session('coupon')){
        $data['shipping_discount'] = session('coupon')['value'];
    }
    Cart::where('user_id', auth()->user()->id)->where('order_id', null)->update(['order_id' => session()->get('id')]);

    // return session()->get('id');
    $provider = new ExpressCheckout;

    $response = $provider->setExpressCheckout($data);

    return redirect($response['paypal_link']);
srmklive commented 8 months ago

Use v1 package for this.

robertnicjoo commented 3 months ago

why use Srmklive\PayPal\Services\ExpressCheckout; doesn't exist in v3? what is the alternative facade?

srmklive commented 3 months ago

v3 uses the latest PayPal Rest API. Express Checkout is no longer actively supported by PayPal.