簡體   English   中英

Omnipay-Laravel-完成貝寶付款

[英]Omnipay - Laravel - Finalize Paypal Pyment

我有以下SuccessPayment方法:

    public function getSuccessPayment() {
    $gatewayFactory = new \Omnipay\Common\GatewayFactory;
    $gateway = $gatewayFactory->create('PayPal_Express');
    #Test API Sandbox
    $gateway->setUsername('xxxxxxx.de');
    $gateway->setPassword('xxxxxxxxx');
    $gateway->setSignature('xxxxx.xxxxx.xxxxx.xxxxxxx');
    $gateway->setTestMode(true);

    # FINALIZZZE PAYPAL PAYMENT
    $response = $gateway->completePurchase($this->getApiInfos())->send();
    $data = $response->getData();

    # IF SUCCESSFULLLLLLL
    if($data['ACK'] == 'Success'):
        $order = Order::where('paypalToken',$data['TOKEN'])->first();
        # Set Status
        $order->orderSuccess = 4;
        $order->orderPaid = 1;
        # Set PP ID
        $order->paypalTransactionId = $data['PAYMENTINFO_0_TRANSACTIONID'];
        $order->save();

        # Destroy Cart
        Cart::destroy();

        # Send Confirm Mail
        $this->sendConfirmOrderMail($order->id, Auth::user()->id);

        return View::make('pages.checkout.success', compact(['order','data']));
    endif;
}  

$ this-> getApiInfos()具有要發送到PP的憑據和信息,這是方法:

    public function getApiInfos($order = NULL) {
  return array(
    'amount'=> Cart::total(),
    'cancelUrl' => \URL::route('paypal_cancel_order'),
    'returnUrl' => \URL::route('paypal_return'),
    'description' => 'Your Payment at xxxxxx - Order #',
    'currency' => 'EUR'
  );
}  

查看說明。 重定向到Paypal之后,又重定向回我的頁面后,如何在訂單說明中獲取orderID?
我失去了會話和順序(我想是!),那我該怎么辦呢?

另外,您知道嗎,我如何通過Omnipay將運費,稅金和抬頭圖像發送到PayPal?

要獲取發送給貝寶的交易參考,您可以

$response->getTransactionReference();

對於您的問題的后半部分:
PayPal Express網關具有以下用於設置圖像的功能:

$gateway->setHeaderImageUrl()
$gateway->setLogoImageUrl()

所有請求都具有以下功能

$request->setTaxAmount()
$request->setShippingAmount()
$request->setHandlingAmount()
$request->setShippingDiscount()
$request->setInsuranceAmount()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM