php - 沙盒模式Paypal认证错误 : Laravel 5. 5

标签 php paypal laravel-5.4 paypal-sandbox laravel-5.5

Reference

代码

public function ShowPaymentWithPaypal()
{
    $payer = new Payer();
    $payer->setPaymentMethod('paypal');
    $item_1 = new Item();
    $item_1->setName('Item 1') /** item name **/
        ->setCurrency('USD')
        ->setQuantity(1)
        ->setPrice(2); /** unit price **/

    $item_list = new ItemList();
    $item_list->setItems(array($item_1));
    $amount = new Amount();
    $amount->setCurrency('USD')
        ->setTotal(2);

    $transaction = new Transaction();
    $transaction->setAmount($amount)
        ->setItemList($item_list)
        ->setDescription('Your transaction description');

    $redirect_urls = new RedirectUrls();
    $redirect_urls->setReturnUrl(\URL::route('ReturnedFromPaypal')) /** Specify return URL **/
        ->setCancelUrl(\URL::route('CancelledPaymentWithPaypal'));

    $payment = new Payment();
    $payment->setIntent('Sale')
        ->setPayer($payer)
        ->setRedirectUrls($redirect_urls)
        ->setTransactions(array($transaction));
        /** dd($payment->create($this->_api_context));exit; **/

    try {
        $payment->create($this->_api_context);
    } catch (\PayPal\Exception\PPConnectionException $ex) {
        dd($ex);
        if (\Config::get('app.debug')) {
            \Session::put('error','Connection timeout');
            return "Error occured";
            /** echo "Exception: " . $ex->getMessage() . PHP_EOL; **/
            /** $err_data = json_decode($ex->getData(), true); **/
            /** exit; **/
        } else {
            \Session::put('error','Some error occur, sorry for inconvenient');
            return "Error occured";
            /** die('Some error occur, sorry for inconvenient'); **/
        }
    }
    foreach($payment->getLinks() as $link) {
        if($link->getRel() == 'approval_url') {
            $redirect_url = $link->getHref();
            break;
        }
    }
    /** add payment ID to session **/
    \Session::put('paypal_payment_id', $payment->getId());
    if(isset($redirect_url)) {
        /** redirect to paypal **/
        return \Redirect::away($redirect_url);
    }
    \Session::put('error','Unknown error occurred');
    return "Last line error";
}

有什么问题?

当我尝试使用沙箱凭据进行付款登录时,出现以下错误。

We aren't able to process your payment using your PayPal account at this time. Please go back to the merchant and try using a different payment method.

I am following this to configure Paypal in Laravel 5.5

XHR 错误详情

enter image description here 我错过了什么吗?

最佳答案

看起来像是 Paypal 的限制。

在此link ,例如,支持说俄罗斯法律限制 paypal 帐户交易为 100000 卢布。

当你达到限制时,你必须在你的事件中指定一些东西来解锁限制。

您是否已达到您所在国家/地区的交易金额限制? 尝试使用较低的金额,如 0.01,并从沙盒帐户(卖家)中删除旧的测试交易。

如果您没有为卖家进行大量交易,那么问题可能出在客户的账户上?尝试创建一个新帐户并使用它。

我想在沙盒中会有一个解锁的地方

关于php - 沙盒模式Paypal认证错误 : Laravel 5. 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34501486/

相关文章:

php - Laravel 集合 orderBy 关系列

php - Magento 皮肤 url 'default' 替换为 'theme'?

wordpress - woocommerce Paypal 高级身份验证错误

助手中的 Laravel 访问 Blade 变量

php - Laravel 5.4 建议通过 migrate :reset? 使用 "enable/disableForeignKeyConstraints()"

php - 如何在php上使用SQL查询按不同字段进行大规模排序?

php - 制作一个 ScrollView ,当用户向下滚动时更新

php - yql和paypal交易

paypal - 如何设置 CreateRecurringPaymentsProfile IPN

laravel-5.4 - Laravel 错误处理,get_class 与 instanceof