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