簡體   English   中英

Paypal REST API不會在Paypal沙盒或實時網站上顯示付款金額

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

休息api正常工作,但未按順序顯示金額“按順序未顯示金額但顯示說明?” “我正在使用下面的代碼傳遞數量和描述”

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM