为了账号安全,请及时绑定邮箱和手机立即绑定

Braintree 中的托管字段给出错误“无法确定付款方式”PHP Laravel

Braintree 中的托管字段给出错误“无法确定付款方式”PHP Laravel

PHP
噜噜哒 2022-10-28 09:43:46
谁能解释我如何在 Laravel 中使用托管字段进行有效的 Braintree 付款。我试图自己查看文档,但无法使其正常工作。我在控制器中创建了要发送到视图的令牌,例如:$gateway = new \Braintree\Gateway([            'environment' => config('services.braintree.environment'),            'merchantId' => config('services.braintree.merchantId'),            'publicKey' => config('services.braintree.publicKey'),            'privateKey' => config('services.braintree.privateKey')        ]);$paypalToken = $gateway->ClientToken()->generate();return view('checkout')->with(['paypalToken' => $paypalToken]);这是我处理付款的方法:        $gateway = new \Braintree\Gateway([            'environment' => config('services.braintree.environment'),            'merchantId' => config('services.braintree.merchantId'),            'publicKey' => config('services.braintree.publicKey'),            'privateKey' => config('services.braintree.privateKey')        ]);        $nonce = $request->payment_method_nonce;        $result = $gateway->transaction()->sale([            'amount' => round(getNumbers()->get('newTotal') / 100, 2),            'paymentMethodNonce' => $nonce,            'options' => [              'submitForSettlement' => True            ]          ]);        if ($result->success) {            $transaction = $result->transaction;            $order = $this->addToOrdersTablesPaypal(                $email,                $firstName.' '.$lastName,                null            );            return redirect()->route('confirmation.index')->with('success_message', 'Thank you! Your payment has been successfully accepted!');        } else {            $order = $this->addToOrdersTablesPaypal(                $email,                $firstName.' '.$firstName,                $result->message            );            return back()->withErrors('An error occurred with the message: '.$result->message);        }谁能帮助我,了解缺少什么?
查看完整描述

1 回答

?
牧羊人nacy

TA贡献1862条经验 获得超7个赞

我解决了它,我实际上找到了一种解决方法,我必须为托管字段创建一个控制器,并且它有效。



查看完整回答
反对 回复 2022-10-28
  • 1 回答
  • 0 关注
  • 63 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信