[英]Use Paypal Pro instead of Paypal Express - Omnipay for Laravel
我有一個購物車,當前正在將用戶重定向到貝寶直接付款。 我想允許客戶在網站上輸入他們的信用卡,然后使用貝寶進行處理。 我有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();`
通過以下方式設置網關:
$gateway = Omnipay::gateway('Paypal_Pro');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.