使用Paypal Pro代替Paypal Express-Laravel Omnipay [英] Use Paypal Pro instead of Paypal Express - Omnipay for Laravel
问题描述
我有一个购物车,当前正在将用户重定向到贝宝直接付款.我想允许客户在网站上输入他们的信用卡,然后使用贝宝(Paypal)进行处理.我有Paypal Pro帐户,但无法使用它.我不确定如何通过Omnipay使用Paypal Pro软件包.在我的vendors
文件夹中,有一个ExpressGateway.php
和Progateway.php
,但是不确定如何调用Progateway.php
页面.我看到的设置它的唯一方法是使用Omnipay::getway('paypal')
,这是我目前为表达而做的.我需要使用什么流程才能使用Paypal Pro?
I have a shopping cart that currently is redirecting users to paypal directly to make their payment. I am wanting to allow customers to input their credit card on the site and paypal to process it. I have Paypal Pro account but I am having trouble using it. I am not sure how I can use the Paypal Pro package via Omnipay. In my vendors
folder I have a ExpressGateway.php
and a Progateway.php
but not sure how to call the Progateway.php
page. The only way I can see to set it is by using Omnipay::getway('paypal')
which I currently do for express. What is the process i need to use in order to use 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();`
推荐答案
以这种方式设置网关:
$gateway = Omnipay::gateway('Paypal_Pro');
这篇关于使用Paypal Pro代替Paypal Express-Laravel Omnipay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!