【发布时间】:2015-04-22 05:02:08
【问题描述】:
我在 Laravel 4 上使用 lib PayPal-PHP-SDK
我在显示订单详细信息时遇到问题。 我按照Paypal Web Checkout的步骤进行操作 它没有向我显示订单详细信息。
上面写着“您可以在付款前查看订单详情。” - Image Link
这是我获得付款链接时的方法:
public function checkout()
{
$apiContext = new ApiContext($this->cred, 'Request' . time());
$apiContext->setConfig($this->sdkConfig);
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$amount = new Amount();
$amount->setCurrency("EUR");
$amount->setTotal("10");
$transaction = new Transaction();
$transaction->setDescription("Example");
$transaction->setCustom('abv');
$transaction->setAmount($amount);
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl(URL::to('/') . '/payment/success/');
$redirectUrls->setCancelUrl(URL::to('/') . '/payment/cancel/');
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
$payment->create($apiContext);
print $payment->getApprovalLink();
}
【问题讨论】: