How to pass dynamic amount in paypal buy now button - paypal

I have made a paypal buy now button , but is not taking dynamic amount which i am sending by form like
amount variable in input type hidden
It only takes price which is set while creating form.
Please give me solution , so that i can pass dynamic price and get payment for it.

Finally my this code works now
<form action='https://www.paypal.com/cgi-bin/webscr' method='post' name='form'>
<input type='hidden' name='business' value='myname#gmail.com'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' value='itemname'>
<input type='hidden' name='item_number' value='2'>
<input type='hidden' name='amount' value='2 0'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='cancel_return' value='http://cancel.com'>
<input type='hidden' name='return' value='http://return.com/'>
<input type="image" src="https://paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit">
</form>

As of June 29, 2017 I see this not working. Paypal has again changed its rules, and I don't think it any longer accepts hidden HTML fields in the form submission: they must be set in the button editor at Paypal.

Related

Paypal buy now button in email does not work

I implemented paypal buy now button in email that is sent from my site. I created the the button(html button) dynamically using PHP(amount is variable for the button).
But the button in email takes me to a different website when i click it. Only yahoo mail take me to the "Your order summary" page (which is the actual page i want to go) all other email client(gmail, hotmail) open http://client.updatemyprofile.com/d-l-2AD73FFF-l-o this page. the html code that shows in email are like below.
<form target="_blank" name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" onsubmit="return theMainWindow.showFormWarning(this)" method="post">
<a rel="nofollow" target="_blank" href="http://client.updatemyprofile.com/d-l-2AD73FFF-l-o" lang="en">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="****#*****.com">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="item_name" value="Agro">
<input type="hidden" name="amount" value="488.97">
<input type="image" src="https://www.paypalobjects.com/fr_FR/i/btn/x-click-but06.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<p></p>
</a>
</form>
Yahoo email button (works)
->
Other emails button (does not work)
->
Need solution for this problem. Thanks in advance.

paypal notify_url is empty even though it is passed on the form

imn submitting this form to send users to recurring payments registration
<form name='_xclick' id='_xclick' action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='cmd' value='_xclick-subscriptions'>
<input type='hidden' name='business' value='xxxxx#gmail.com'>
<input type='hidden' name='currency_code' value='EUR'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='a3' value='90.00'>
<input type='hidden' name='p3' value='1'>
<input type='hidden' name='t3' value='M'>
<input type='hidden' name='custom' value='customerId=F5C311'>
<input type='hidden' name='src' value='1'>
<input type='hidden' name='sra' value='1'>
<input type='hidden' name='item_name' value='xxxxx'>
<input type='hidden' name='cancel_return' value='http://www.xxxxxx.com/package-success?pplstatus=0&customerId=F5C311'>
<input type='hidden' name='return' value='http://www.xxxxxx.com/package-success?pplstatus=1&customerId=F5C311'>
<input type='hidden' name='notify_url' value='http://www.xxxxxx.com/package-success?pplstatus=IPN&pplstatus=0&customerId=F5C311'>
<input type='hidden' name='rm' value='2'>
</form>
<script>document.forms['_xclick'].submit();</script>
for some mysterious reason when i check PayPal IPN history the notify URL is empty and of course that payment is not being processed on my system (attached the PayPal message info).
Message delivery is Enabled and as URL i have written http://www.xxxxxxx.com/?pplstatus=IPN
What am i doing wrong here ?
This is a known issue that we're currently working to resolve. IPN messages will still send as normal, but the IPN history page may not reflect the right state / notify_url details.
edit: This has been resolved as of 29/04. Please let me know if you run into any further issues.
I have similar problem which I have described here:
https://stackoverflow.com/questions/16174275/why-paypal-does-not-call-my-notify-url-but-on-sandbox-everything-works
But my status is Retrying and my IPN is not being called. I really don't know what is going on.

PayPal get params after success returned

I am currently implement PayPal into a form for articles subscription, below codes are run fine to direct to paypal web screen and process the transaction.
HOW if I want to get back certain params after transaction has successfully made? I tried echo $_REQUEST['custom'], $_REQUEST['email'], $_REQUEST['a3'] and $_REQUEST['p3'] after redirect from paypal back to returned url, BUT only $_REQUEST['custom'] is display, how can I get these params back for further proccess?
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="someone_1360103868_biz#sitename.com">
<input type="hidden" name="email" value="<?php echo $BuyerEmail ?>">
<input type="hidden" name="item_name" value="<?php echo $ProdDesc ?>">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="return" value="http://sitename.com/return.php?msg=Transaction+Complete">
<input type="hidden" name="cancel_return" value="http://sitename.com/return.php?msg=Transaction+Canceled">
<input type="hidden" name="notify_url" value="http://sitename.com/notify.php">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="<?php echo $Currency ?>">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="custom" value="<?php echo $RefNo ?>">
<input type="hidden" name="a3" value="<?php echo $Amount ?>">
<input type="hidden" name="p3" value="<?php echo $Duration ?>">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="submit" name="Submit" value="Pay now">
</form>
one way i have found:
try to insert this field into your generated form code:
<input type='hidden' name='rm' value='2'>
rm means return method;
2 means (post)
Than after user purchases and returns to your site url, then that url gets the POST parameters as well
p.s. if using php, try to insert var_dumy($_POST); in your return url(script),then make a test purchase and when you return back to your site you will see what variables are got on your url.
Trying to get back the information is not necessary if you record them on the way out, ie: before submitting to Paypal. For example it's a good idea to record all attempts so that you can follow up on failed transactions, ie: users having card problems, bugs in your code, etc.
If you are using a "good" shopping cart this will already be included. So when someone completes and submits an order form, your shopping cart adds the record and generates a new order number (ID number). The form submitting to Paypal can then include that ID number, so all that you need to retrieve after a successful transaction is that ID number and then you can programmatically update the order as paid and provide a printable receipt online that is populated from your database table.
To do this all you need to do is retrieve Request("item_number")
How are you wanting to return the information to your site. Are you wanting it returned to the return page on your site so that you can display it to your buyer, or are you just wanting it returned to your system to update a database. If you are wanting the mbuyer to see this on the return page, you would want to use either the return method where you use the variable "rm" and pass over the return URL in your button code. You can use a POST for this method, or you can use PDT and this will be a GET method. PDT will also allow you to validate the data against the PayPal. Then there is IPN, which will not be desplayed to the buyer. This would be used for udpating your database. See my post I made here as well, as this may have some more useful information.

Pre-populate "Send Payment" data on PayPal?

Is there a way to pre-populate the "Send Payment" data on PayPal? I don't wan't a pay now button, I just want to be able to have a button for my own internal use that launches the Paypal website and pre populates the fields to send a payment to somebody. Is that possible?
I've tried using a form that submits the data to paypal, but I have a problem, the AMOUNT field doesn't populate, and I have no idea what I'm doing wrong!
This is what I have so far:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target = "paypal">
<input type="hidden" name="cmd" value="_send-money">
<INPUT TYPE="hidden" name="charset" value="utf-8">
<INPUT TYPE="hidden" NAME="email" VALUE="someone#gmail.com">
<INPUT TYPE="hidden" NAME="currency_code" VALUE="USD">
<input type="hidden" name="amount" value="15.00">
<input type="submit" value="Open Paypal">
</form>
You could try redirecting to the paypal.me/accountname/moneyamount (example: paypal.me/johnsmith/50) to have it bring you to a page that pays the john smith account with a pre-filled amount of $50. This functionality is set up by default.
https://www.paypal-community.com/t5/Products-and-Services/Can-the-PayPal-me-URL-be-modified-to-pre-fill-the-quot-Note-quot/td-p/1509015

Is it possible make a PayPal 'Buy Now' button with an HTML form?

I have a Google Checkout 'Buy Now' button on my site. It's very simple, all I do is produce the order information in an HTML form thus:
<form action="https://checkout.google.com/cws/v2/Merchant/xxxxxxxxxx/checkoutForm" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm">
<input name="item_name_1" type="hidden" value="Some Stuff">
<input name="item_description_1" type="hidden" value="Product">
<input name="item_quantity_1" type="hidden" value="1">
<input name="item_price_1" type="hidden" value="0.25">
<input name="item_currency_1" type="hidden" value="GBP">
<input name="item_name_2" type="hidden" value="Delivery">
<input name="item_description_2" type="hidden" value="standard">
<input name="item_quantity_2" type="hidden" value="1">
<input name="item_price_2" type="hidden" value="2.5">
<input name="item_currency_2" type="hidden" value="GBP">
<input name="_charset_" type="hidden" value="utf-8">
<input alt="" src="https://checkout.google.com/buttons/buy.gif?merchant_id=xxxxxxxxxx&w=117&h=48&style=white&variant=text&loc=en_US" type="image">
</form>
This form is generated by a bit of PHP, it's fairly trivial to put together. Is there a way of creating a PayPal button in the same way? Some customers have requested it, but I don't have time to delve into complex APIs, and static saved buttons are no good (the customer fills out a short order form, which then generates the button).
Is this what you´re looking for?
=> http://net.tutsplus.com/tutorials/html-css-techniques/creating-a-paypal-payment-form/
=> https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_techview_outside