我有一个购物车,目前正在将用户直接重定向到PayPal进行付款。我想让客户在网站上输入他们的信用卡和paypal来处理它。我有Paypal Pro帐户,但我无法使用它。我不确定如何通过Omnipay使用Paypal Pro软件包。在我的vendors
文件夹中,我有一个ExpressGateway.php
和一个Progateway.php
,但不知道如何调用Progateway.php
页面。我可以看到设置它的唯一方法是使用我目前用于表达的Omnipay::getway('paypal')
。我需要使用什么过程才能使用Paypal Pro?
$gateway = Omnipay::gateway('paypal');
if(Auth::user() != NULL && Auth::user()->super_user == 1) {
//sandbox
$gateway->setUsername('#######');
$gateway->setPassword('#######');
$gateway->setSignature('#######');
$gateway->setTestMode('true');
} else {
//production
$gateway->setUsername('#######');
$gateway->setPassword('#######');
$gateway->setSignature('######');
}
$cardInput = array(
'firstName' => $info['first_name_bill'],
'lastName' => $info['last_name_bill'],
'billingAddress1' => $info['street_address_1_bill'],
'billingAddress2' => $info['street_address_2_bill'],
'billingPhone' => $info['phone_bill'],
'billingCity' => $info['city_bill'],
'billingState' => $info['state_bill'],
'billingPostCode' => $info['zip_bill'],
'shippingAddress1' => $info['street_address_1_ship'],
'shippingAddress2' => $info['street_address_2_ship'],
'shippingPhone' => $info['phone_ship'],
'shippingCity' => $info['city_ship'],
'shippingState' => $info['state_ship'],
'shippingPostCode' => $info['zip_ship'],
);
$card = Omnipay::creditCard($cardInput);
$response = Omnipay::purchase(
array(
'cancelUrl' => URL::to('cart'),
'returnUrl' => URL::action('CartController@getSuccessPayment', array('id' =>$invoice->id)),
'amount' => Input::get('total'),
'currency' => 'USD',
'card' => $card,
'description' => '#####'
)
)->send();`
答案 0 :(得分:0)
以这种方式设置网关:
$gateway = Omnipay::gateway('Paypal_Pro');