0

我有以下 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 吗?

4

1 回答 1

3

要获取您发送到 Paypal 的交易参考,您可以执行以下操作

$response->getTransactionReference();

对于你问题的后半部分:
PayPal Express 网关具有以下设置图像的功能:

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

所有的请求都有以下功能

$request->setTaxAmount()
$request->setShippingAmount()
$request->setHandlingAmount()
$request->setShippingDiscount()
$request->setInsuranceAmount()
于 2014-10-27T16:08:43.840 回答