【问题标题】:Paypal REST API does not show up payment amount on Paypal Sandbox or live sitesPaypal REST API 不会在 Paypal Sandbox 或实时网站上显示付款金额
【发布时间】:2014-06-15 02:32:31
【问题描述】:

Rest 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

【问题讨论】:

    标签: php paypal paypal-sandbox paypal-rest-sdk


    【解决方案1】:

    创建包含至少一项的 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));
    

    【讨论】:

    • 感谢回复,但仍然没有解决,当我在我的页面中添加这两个项目和项目列表时,它显示空白页面。 $ 项目 = 新项目(); $item->setQuantity(1); $item->setName($paymentDescription); $item->setPrice($paymentAmount); $item->setCurrency($paymentCurrency); $itemList = new ItemList(); $itemList->setItems(array($item));
    猜你喜欢
    • 2013-03-30
    • 2013-05-14
    • 2013-01-05
    • 2020-09-18
    • 1970-01-01
    • 2016-09-17
    • 2020-09-02
    • 2011-11-21
    • 2017-07-13
    相关资源
    最近更新 更多