Paypal PDT如何获得单品价格

时间:2016-02-04 08:38:45

标签: paypal paypal-sandbox

我的单件商品价格 2.00 ,如果买家购买2件数量,价值' mc_gross'将变为 4.00 。我的' item_number'值 1 。所以我尝试使用' mc_gross_1'获取单项值,但返回空值。

我暂时解决的问题是使用' mc_gross' /'数量'获得单项价格。我指的是here

我的网站只有“立即购买”。按钮和单个项目,而不是购物车。

我的代码如下:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="QAZN7GVGZPERC">
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_buynow_pp_142x27.png" border="0" name="submit" 

alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

1 个答案:

答案 0 :(得分:0)

我使用的HTML代码相同:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="XXX-facilitator@gmail.com">
<input type="hidden" name="currency_code" value="US">

<input type="hidden" name="item_name_1" value="IT SERVER">
<input type="hidden" name="amount_1" value="15">

<input type="hidden" name="item_name_2" value="convenience fees">
<input type="hidden" name="amount_2" value="5.00">
<input type="hidden" name="return" value="http://localhost/justbuy/pdtreturn.php">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

mc_gross_1应该返回第一个商品价格。我已经测试过,这里是返回的pdt详细信息。

SUCCESS

mc_gross=30.80
protection_eligibility=Eligible
address_status=confirmed
item_number1=
tax=0.80
item_number2=
payer_id=ZK5AUW8MWY9CW
ebay_txn_id1=
address_street=1+Main+St
ebay_txn_id2=
payment_date=01%3A11%3A41+Feb+04%2C+2016+PST
payment_status=Completed
charset=UTF-8
address_zip=95131
mc_shipping=10.00
mc_handling=0.00
first_name=vimalbuyer
mc_fee=1.19
address_country_code=US
address_name=vimalbuyer+ravichandran
custom=
payer_status=verified
business=vimal53-facilitator%40gmail.com
address_country=United+States
num_cart_items=2
mc_handling1=0.00
mc_handling2=0.00
address_city=San+Jose
payer_email=vimalbuyer%40gmail.com
mc_shipping1=0.00
mc_shipping2=0.00
tax1=0.00
tax2=0.00
contact_phone=408-329-3451
txn_id=99E872700B3517715
payment_type=instant
last_name=ravichandran
address_state=CA
item_name1=IT+SERVER
receiver_email=vimal-facilitator%40gmail.com
item_name2=convenience+fees
payment_fee=1.19
shipping_discount=0.00
quantity1=1
insurance_amount=0.00
quantity2=1
receiver_id=S4X5XW328WAYY
txn_type=cart
discount=0.00
mc_gross_1=15.00
mc_currency=USD
mc_gross_2=5.00
residence_country=US
shipping_method=Express
transaction_subject=
payment_gross=30.80