gpt4 book ai didi

php - Paypal 成功 url 错误 laravel

转载 作者:太空宇宙 更新时间:2023-11-03 16:07:16 24 4
gpt4 key购买 nike

我正在使用 laravel Omni 插件进行交易。付款完成后,我收到成功网址错误。

public function  checkOut(Request $request)
{
$params = array(
'cancelUrl' => 'http://localhost/vis/public/cancel_order',
'returnUrl' => 'http://localhost/vis/public/payment_success',
'name' => 'Meal',
'description' => 'Casper',
'amount' => '1.00',
'currency' => 'USD'
);

Session::put('params', $params);
Session::save();
$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername('un');
$gateway->setPassword('pwd');
$gateway->setSignature('signature');
$gateway->setTestMode(true);
$response = $gateway->purchase($params)->send();

if ($response->isSuccessful()) {
print_r($params);
redirect('payment_success/' . $this->orderNo);
// payment was successful: update database
print_r($response);
} elseif ($response->isRedirect()) {

// redirect to offsite payment gateway
$response->redirect();
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
}

public function getSuccessPayment()
{
$gateway = Omnipay::create('PayPal_Express');
$gateway->setUsername('un');
$gateway->setPassword('pwd');
$gateway->setSignature('signature');
$gateway->setTestMode(true);

$params = Session::get('params');
$response = $gateway->completePurchase($params)->send();
$paypalResponse = $response->getData(); // this is the raw response object

if(isset($paypalResponse['PAYMENTINFO_0_ACK']) && $paypalResponse['PAYMENTINFO_0_ACK'] === 'Success') {
// Response
print_r($params);
// print_r($paypalResponse);

} else {

//Failed transaction

}
// return View('result');
print_r($params);
print_r($paypalResponse);
}

出现以下错误

Not Found HTTP Error 404. The requested resource is not found. http://localhost/vis/public/payment_success?token=EC-1R845179Asss493N&PayerID=swdw3BS9REA4AN

最佳答案

看起来你可能忘记在 routes.php 中添加该路由,确保你在 routes.php 中有类似的东西

Route::get('/payment_success', 'StoreController@getSuccessPayment');

将 StoreController 更改为此函数所在的 Controller 的名称。

关于php - Paypal 成功 url 错误 laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36289141/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com