请帮助我。
我正在尝试将全方位付款/贝宝集成到付款中。一切正常,直到我需要验证我的付款为止。我如何注册付款:
$gateway = Omnipay::create('PayPal_Rest');
$gateway->initialize(array(
'clientId' => $config['paypal_client_id'],
'secret' => $config['paypal_secret'],
'testMode' => true, // Or false when you are ready for live transactions
));
$response = $gateway->purchase(array(
'amount' => $data['price_sum'],
'currency' => 'PLN',
'description' => 'NNŻ: ' . $description . $data['order_id'],
'transactionId' => $data['order_id'],
'returnUrl' => $app_url . 'basket/pay?token=' . $data['token'],
'cancelUrl' => $app_url . 'basket/pay?token=' . $data['token'],
'notifyUrl' => $app_url . 'payment/verify-basket-paypal'
))->send();
//print_r( get_class_methods( $response ) );
// Process response
if ($response->isSuccessful()) {
$transaction_id = $response->getTransactionReference();
Kernel::log('paypal.log' , $transaction_id);
return ['url' => $response->getRedirectUrl(), 'paypal' => true ];
} elseif ($response->isRedirect()) {
// Redirect to offsite payment gateway
$response->redirect();
} else {
// Payment failed
echo $response->getMessage();
}
在html页面上,我添加了带有url($ response-> getRedirectUrl())的按钮,此后,我被重定向到同一页面,如果付款正确,我将在此页面进行验证。
网址还有其他GET参数:
/ payment / verify-basket-paypal?paymentId = PAYID-L37QMOY42K85628E4550351P&token = EC-3SM080895T541133U&PayerID = Y3DZ53CGGL47N
我已经尝试过类似的事情:
$gateway = Omnipay::create('PayPal_Rest');
$gateway->initialize(array(
'clientId' => $config['paypal_client_id'],
'secret' => $config['paypal_secret'],
'testMode' => true, // Or false when you are ready for live transactions
));
$transaction = $gateway->fetchTransaction([
'paymentId' => $request->get['paymentId'],
'token' => $request->get['token'],
'PayerID' => $request->get['PayerID']
]);
但是它不起作用。请帮助,我该如何验证付款。他们的页面上没有其他文档。非常感谢。