【问题标题】:Class 'Srmklive\PayPal\Services\ExpressCheckout' not found找不到类“Srmklive\PayPal\Services\ExpressCheckout”
【发布时间】:2021-02-19 18:09:35
【问题描述】:

我正在使用一个名为 srmklive/paypal 的 Laravel paypal 插件。

php 版本:7.3.12 Laravel 版本:6.2

请帮忙。

日志显示这个错误:

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Srmklive\PayPal\Services\ExpressCheckout' not found in file C:\wamp64\www\chefruntown\app\Http\Controllers\User\Web\CartController.php on line 214

这是我的控制器视图

<?php

namespace App\Http\Controllers\User\Web;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Support\Facades\DB;
use Srmklive\PayPal\Services\ExpressCheckout;

class CartController extends Controller
{
    public function handlePayment(Request $request)
    {
        DB::beginTransaction();
        $cart = getUserCart();
        $items = getUserCart()->cartItems;

        $product = [];
        $product['items'] = [
            [
                'name' => $items,
                'price' => $items,
                'qty' => $items
            ]
        ];

        $product['invoice_id'] = 1;
        $product['invoice_description'] = "Order #{$product['invoice_id']} Bill";
        $product['return_url'] = route('success.payment');
        $product['cancel_url'] = route('cancel.payment');
        $product['total'] = $cart->total;

        $paypalModule = new ExpressCheckout;

        $res = $paypalModule->setExpressCheckout($product);
        $res = $paypalModule->setExpressCheckout($product, true);

        return redirect($res['paypal_link']);
    }
}

【问题讨论】:

  • 你使用的是哪个版本的包??
  • 版本 3 包
  • 如果你想使用express check out,你必须使用v 1..
  • 在版本 3 包中使用 express check out 有什么解决方案吗?

标签: php laravel paypal


【解决方案1】:

切换到 srmklive/paypal 包的版本 1 有效

【讨论】:

    猜你喜欢
    • 2019-09-07
    • 2021-04-23
    • 2021-05-22
    • 2013-02-24
    • 2018-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-09
    相关资源
    最近更新 更多