I have Omnipay functioning perfectly in my payment gateway but when the system redirects to PayPal i get the following on screen before redirecting to PayPal:
Redirecting to https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=-=TOKEN IS HERE-
What I'm wondering is if anyone knows how to stop the page displaying and redirect straight to PayPal without this middle page. My code for the redirect is below:
$gateway=GatewayFactory::create('PayPal_Express');
$gateway->setUsername(['username']);
$gateway->setPassword(['password']);
$gateway->setSignature(['signature']);
$gateway->setTestMode(['testing']);
$totalamount=number_format(['ordertotal'],2);
try{
$response=$gateway->purchase(
array(
'cancelUrl' => base_url('paymentMethod/'),
'returnUrl' => base_url('paypalexpress/confirm'),
'amount' => $totalamount,
'currency' => 'GBP'
)
)->send();
if($response->isSuccessful()){
print_r($response);
}elseif($response->isRedirect()){
$response->redirect();
}else{
echo $response->getMessage();
}
}
catch(\Exception $e){
$this->payment(1,$e->getMessage());
}