Php Paypal REST API不会在Paypal沙箱或live站点上显示付款金额
RESTAPI工作正常,但它没有显示订单数量 为了使汇总金额不显示,但说明显示? 我使用下面的代码传递金额和说明Php Paypal REST API不会在Paypal沙箱或live站点上显示付款金额,php,paypal,paypal-sandbox,paypal-rest-sdk,Php,Paypal,Paypal Sandbox,Paypal Rest Sdk,RESTAPI工作正常,但它没有显示订单数量 为了使汇总金额不显示,但说明显示? 我使用下面的代码传递金额和说明 require DIR . '/../bootstrap.php'; use PayPal\Api\Address; use PayPal\Api\Amount; use PayPal\Api\Payer; use PayPal\Api\Payment; use PayPal\Api\FundingInstrument; use PayPal\Api\RedirectUrls; us
require DIR . '/../bootstrap.php';
use PayPal\Api\Address;
use PayPal\Api\Amount;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\FundingInstrument;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Transaction;
$charge = trim($_POST['amount']);
$currency = trim($_POST['currency']);
$desc = trim($_POST['desc']);
$get_url=trim($_SESSION['get_url']);
$payer = new Payer();
$payer->setPayment_method("paypal");
$amount = new Amount();
$amount->setCurrency($currency);
$amount->setTotal($charge);
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setDescription($desc);
}
"In order summery its showing description but amount is not showing."
Please help me to sort out this problem"
Thank for you help.
Sunil
创建至少包含一个项目的ItemList并将其添加到事务中。 以下是一个例子:
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$amount = new Amount();
$amount->setCurrency($paymentCurrency);
$amount->setTotal($paymentAmount);
$item = new Item();
$item->setQuantity(1);
$item->setName($paymentDescription);
$item->setPrice($paymentAmount);
$item->setCurrency($paymentCurrency);
$itemList = new ItemList();
$itemList->setItems(array($item));
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemList);
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl($returnUrl);
$redirectUrls->setCancelUrl($cancelUrl);
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
创建至少包含一个项目的ItemList并将其添加到事务中。 以下是一个例子:
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$amount = new Amount();
$amount->setCurrency($paymentCurrency);
$amount->setTotal($paymentAmount);
$item = new Item();
$item->setQuantity(1);
$item->setName($paymentDescription);
$item->setPrice($paymentAmount);
$item->setCurrency($paymentCurrency);
$itemList = new ItemList();
$itemList->setItems(array($item));
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemList);
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl($returnUrl);
$redirectUrls->setCancelUrl($cancelUrl);
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
感谢您的回复,但仍然没有修复,当我在我的页面中添加这两个项目和项目列表时,它会显示空白页面$项目=新项目$项目->设置数量1$item->setName$paymentDescription$项目->设置价格$paymentAmount$项目->设置货币$paymentCurrency$itemList=新的itemList$itemList->setItemsarray$item;感谢您的回复,但仍然没有修复,当我在我的页面中添加这两个项目和项目列表时,它会显示空白页面$项目=新项目$项目->设置数量1$item->setName$paymentDescription$项目->设置价格$paymentAmount$项目->设置货币$paymentCurrency$itemList=新的itemList$itemList->setItemsarray$item;