Paypal _cart not showing tax and shipping in sandbox - paypal

I've got a paypal form to request a payment that I'm testing in www.sandbox.paypal.com.
It works as I expect, except for tax and shipping costs, that are ignored and not shown in paypal cart and not computed in cart total amount.
In this case I only have one product, but buyers can add more products to their carts.
I can't understand where I'm going wrong.
<form method="post" name="paypal_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type='hidden' name='cmd' value='_cart'>
<input type='hidden' name='business' value='myEmail'>
<input type='hidden' name='charset' value='utf-8'>
<input type='hidden' name='currency_code' value='EUR'>
<input type='hidden' name='notify_url' value='http://mysite/shop/ipn_url.php'>
<input type='hidden' name='custom' value='xxxaasxdfd'>
<input type='hidden' name='return' value='http://mysite/shop/confirm_url.php'>
<input type='hidden' name='lc' value='IT'>
<input type='hidden' name='email' value='buyer#mysite'>
<input type='hidden' name='first_name' value='Test name'>
<input type='hidden' name='last_name' value='Test surname'>
<input type='hidden' name='zip' value='00000'>
<input type='hidden' name='no_note' value='1'>
<input type='hidden' name='cbt' value='Return to mysite'>
<input type='hidden' name='rm' value='2'>
<input type='hidden' name='cancel_return' value='http://mysite/shop/cancel_url.php'>
<input type='hidden' name='upload' value='1'><input type='hidden' name='amount_1' value='129.00'>
<input type='hidden' name='item_name_1' value='23-PROD11'>
<input type='hidden' name='item_number_1' value='120'>
<input type='hidden' name='tax' value='39.37'>
<input type='hidden' name='shipping' id='shipping' value='67.87'>
</form>

I found that the VAT and the shipping cost are visible and computed if I pass them for every single item in my cart.
<input type='hidden' name='shipping_1' id='shipping' value='67.87'>
<input type='hidden' name='tax_1' value='39.37'>
I've charged them on the first item as shipping_1 and tax_1 in the cart for all my items, in this way I'm sure that it will work for cart with one or more items.

Related

Unable to complete payment in paypal sandbox

I have an issue with making PayPal sandbox payments. Whenever I try to make a payment it requires me to log into the buyer account, but when I do log in I get redirected to the buyer profile page. If I then try to repeat the payment again, it still asks me to log in and if I do login I once again get redirected to the buyer profile page.
The payments were working fine a day or two ago on a test server that hasn't had anything changed on it since then. I tried clearing cookies and going incognito as recommended by some people, but that didn't seem to help.
Has anyone else encountered this issue?
In answer to myself it seems that it's a problem with PayPal sandbox which is broken and nobody cares about it at PayPal!!! I waste 3 days on this problem. Grrrr
I also found this: https://www.paypal-community.com/t5/About-Business/Paypal-redirect-issue/m-p/1242652
AND this: https://www.paypal-community.com/t5/About-Payments/Something-change-with-paypal-sandbox-donations/m-p/1246095#M97864
I am seriously looking for an alternative to PayPal to manage my subscriptions buttons. Does anyone have any suggestions?
Best Regards,
HB
I Have the same issue with a subscription button... What's going on with PayPal?
My code is as follows:
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' target='_top'>
<input type='hidden' name='business' value='example-facilitator#example.com' />
<input type='hidden' name='cmd' value='_xclick-subscriptions' />
<input type='hidden' name='country' value='UK' />
<input type='hidden' name='no_note' value='1' />
<input type='hidden' name='charset' value='utf-8' />
<input type='hidden' name='lc' value='UK' />
<input type='hidden' name='no_shipping' value='1' />
<input type='hidden' name='sra' value='1' />
<input type='hidden' name='src' value='1' />
<input type='hidden' name='modify' value='0' />
<input type='hidden' name='usr_manage' value='0' />
<input type='hidden' name='invoice' value='INV-L1-2000002-1498316504' />
<input type='hidden' name='item_number' value='pln-l1s0p0' />
<input type='hidden' name='p3' value='1' />
<input type='hidden' name='t3' value='M' />
<input type='hidden' name='rm' value='0' />
<input type='hidden' name='return' value='http://www.example.com' />
<input type='hidden' name='cancel_return' value='http://www.example.com' />
<input type='hidden' name='shopping_url' value='http://www.example.com' />
<input type='hidden' name='item_name' value='Monthly subscription: Basic Plan' id='item_name-basic-monthly' />
<input type='hidden' name='currency_code' value='GBP' />
<select name='a3' id='a3-basic-monthly' style='font-size:110%;'>
<option value='5.00'>5.00 GBP (no options)</option>
<option value='9.80'>+ Options: 9.80 GBP</option>
</select>
<input style='width:170px; height:40px;' type='image' src='https://www.paypal.com/en_GB/i/btn/btn_subscribe_LG.gif' border='0' name='submit' alt='Purchase with PayPal' />
<img alt='' border='0' src='https://www.paypalobjects.com/en_GB/i/scr/pixel.gif' width='1' height='1' />
</form>
Best Regards,
HB

Paypal IPN: notify_url is never called

I'm creating an online shop and all seems to be good but my specified notify_url seems to not get called after the payment succeeded.
<?php
echo "
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='charset' value='utf-8'>
<input type='hidden' value='$price' name='amount' />
<input name='currency_code' type='hidden' value='EUR' />
<input name='shipping' type='hidden' value='0.00' />
<input name='tax' type='hidden' value='0.00' />
<input name='return' type='hidden' value='$nddaff/refill.php' />
<input name='cancel_return' type='hidden' value='$nddaff/refill.php' />
<input name='notify_url' type='hidden' value='http://domain.com/validationpaypal.php' />
<input name='cmd' type='hidden' value='_xclick' />
<input name='business' type='hidden' value='test-facilitator#gmail.com'/>
<input name='item_name' type='hidden' value='$name' />
<input name='custom' type='hidden' value='id=$id&type=$type' />
<input name='lc' type='hidden' value='FR' />
<input name='bn' type='hidden' value='PP-BuyNowBF' />
<input name='sub' value='Buy Now - $price"."€' type='submit' /></form>";
?>
Answer :
There were a bug in paypal sandbox yesterday, all works fine today !
Thanks all for helping !

Paypal PDT how to get single item price

My single item price is 2.00, if buyer buy 2 quantity, the value 'mc_gross' will become 4.00. My 'item_number' value is 1. So I try use the 'mc_gross_1' to get the single item value, but return empty value.
What I temporary solve is use 'mc_gross'/'quantity' to get the single item price. I am referring from here
My site only have a 'Buy Now' button and single item only, not shopping cart.
My code as below:
<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>
Html same code I used:
<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 should return the first item price. I have tested in and here is the pdt details returned.
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

Paypal ipn catch payment cancel event

I am trying to do the following: When the user selects some items and click "Pay Now" button on our website, I mark the selected items status as "on hold" so no one else can select these items. If I receive "complete" from ipn I will mark the items as "purchased" and do other database change. If I receive "canceled" from ipn I will mark the "on hold" items back to "available".
It works fine when the user did make the payment (complete). However, if the user exit the payment flow (for example just close the browser tab) I didn't receive any messages. I am not sure why this is happening. Or the ipn just wouldn't give a message if the transaction is not complete?
Here is the code of the paypal button:
<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="********-facilitator#gmail.com">
<input type="hidden" name="env" value="www.sandbox">
<input type="hidden" name="address_override" value="1">
<c:set var="index" value="${1}"/>
<c:forEach items="${items}" var="item">
<input type="hidden" name="item_name_${index}" value="${item.title}">
<input type="hidden" name="amount_${index}" value="${item.askPrice}">
<input type="hidden" name="tax_${index}" value="$<fmt:formatNumber type="number" maxFractionDigits="2" value="${item.askPrice * taxRate}" />">
<c:if test="${index == 1}">
<input type="hidden" name="shipping_${index}" value="$<fmt:formatNumber type="number" maxFractionDigits="2" value="${shipmentFee}" />">
</c:if>
<c:set var="index" value="${index + 1}"/>
</c:forEach>
<c:remove var="index"/>
<!-- Fill full name in the first_name field -->
<input type="hidden" name="first_name" value="${info.recipient}">
<input type="hidden" name="notify_url" value="<c:url value="https://********.localtunnel.me/payment/paypal/ipn"></c:url>">
<input type="hidden" name="address1" value="${info.addressLine1}">
<input type="hidden" name="address2" value="${info.addressLine2}">
<input type="hidden" name="city" value="${info.city}">
<input type="hidden" name="state" value="${info.state}">
<input type="hidden" name="zip" value="${info.zip}">
<input type="hidden" name="country" value="US">
<input type="hidden" name="email" value="${info.email}">
<input type="hidden" name="custom" value="${flowId}">
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="Check out with PayPal">
</form>

Paypal form select

I'm confounded why this won't work - the first select works, the second one doesn't. The first one though, does not provide any textual info about the selection.
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='business' value='payments#site.com'>
<select name='os0'>
<option value='25€ Individual'>Individual rate - 25€</option>
<option value='75€ Group'>Agency rate - 75€</option>
</select>
<input type='hidden' name='option_index' value='0'>
<input type='hidden' name='option_select0' value='25€ Individual'>
<input type='hidden' name='option_amount0' value='25.00'>
<input type='hidden' name='option_select1' value='75€ Group'>
<input type='hidden' name='option_amount1' value='75.00'>
<input type='hidden' name='currency_code' value='EUR'>
<input type='hidden' name='return' value='http://www.site.com/backtoyou/'>
<input type='submit' value='Pay with PayPal!'>
<img alt='' border='0' src='https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>