简体   繁体   English

Paypal REST API不会在Paypal沙盒或实时网站上显示付款金额

[英]Paypal REST API does not show up payment amount on Paypal Sandbox or live sites

Rest api is working fine but its not showing amount in order summery "In Order summery amount is not showing but description is showing?" 休息api正常工作,但未按顺序显示金额“按顺序未显示金额但显示说明?” "I am using below code to pass amount and description" “我正在使用下面的代码传递数量和描述”

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

Create and add ItemList with at least one item to your transaction. 创建包含至少一项的ItemList并将其添加到您的事务中。 Here is an example: 这是一个例子:

$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));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM