I am trying to create simple PayPal button who pass amount and quantity details to PayPal. I am unable to pass hardcore amount in PayPal. I am expecting to show result like this:
Expected output
Problem is that my amount is not transferring to PayPal. Please support to resolve. Here is my code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" amount="1.0">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="hmmdmlk#gmail.com">
<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">
<input type="submit" value="PayPal">
</form>
When using _xclick, which is for operations on a single item, you want:
<input type="hidden" name="item_name" value="The item name.">
<input type="hidden" name="amount" value="1.00">
The multi-item parameters you were using would be for _cart with upload=1, not _xclick
Documentation: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/
Related
I am trying to make a paypal payment and I have a problem when returning to my page after the payment is completed.
I want to do it dynamically (so I do not want to set it in the paypal's account option, as I may use this account for other things). This is the form I send to paypal:
<form id="paypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="notify_url" value="http://zopomobile.es/pruebas/modules/rmaforsat/ipn_paypal.php">
<input type="hidden" name="item_name_1" value="Pago de su orden a Zopomobile.">
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="amount_1" value="259.12">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="custom" value="152">
<input type="hidden" name="business" value="admin-facilitator#zopomovil.es">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="return" value="http://zopomobile.es/pruebas">
<input type="hidden" name="cancel" value="http://zopomobile.es/pruebas/NO">
<input type="hidden" name="rm" value="2">
</form>
I have tried changing the "return" variable to "return_url", still not working.
If you want to automatically re-direct to "http://www.zopomobile.es/pruebas/"
then you need to turn on "Auto Return" on your PayPal profile.
Right now, Auto Return is "OFF" in your profile.
The return parameter is return
https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments
Check above link to turn on the "Auto Return" feature.
Here is my paypal buy now html code:
<form name="_xclick" action="https://www.paypal.com/ca/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="alex#xumanii.com">
<input type="hidden" name="item_name" value="Bewolf Shooping Cart">
<input type="hidden" name="amount" value="<? echo $grandtotal2;?>">
<input type="hidden" name="add" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="member_id" value="<? echo $info['member_id'];?>">
<input type="hidden" name="return" value="http://www.bewolfclothing.com/thankyou.php">
<input type="hidden" name="notify_url" value="http://www.bewolfclothing.com/notify_paypal2.php">
<input type="hidden" name="cancel_return" value="http://www.bewolfclothing.com/mycart.php">
<input type="hidden" name="undefined_quantity" value="0">
<div class="submit-container"><input class="submit-button" type="submit" name="submit" value="CHECK OUT" /></div>
</form>
In my paypal account, under profile, my selling tools, I have set the AUTO RETURN to ON and I put the thankyou page in there.
After the purchase, it goes to the thankyou page, but the $_REQUEST['tx'] for the paypal transaction ID is not working and the notify_url NEVER gets called.
I searched online and saw that lots of people seem to have trouble with that, but I couldn't find a solution.
notify_url is used to Instant Payment Notification and the url should always be a live URL.
To get the tx ID, you need to
-Auto Return is set to ON
-Valid Return URL
-Payment Data Transfer is set to ON
and in your "http://www.bewolfclothing.com/thankyou.php"
$tx_id = $_GET['tx']; //gives you tx id
I have one code for passing some custom variables to PayPal and these were collected in the return page, but when trying to get these values it is not working
I have a PayPal form like this :
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="submit.png" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="custom" value="IP"/>
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="business" value=""/>
<input type="hidden" name="item_name" value=""/>
<input type="hidden" name="item_number" value=""/>
<input type="hidden" name="amount" value=""/>
<input type="hidden" name="page_style" value=""/>
<input type="hidden" name="no_shipping" value="1"/>
<input type="hidden" name="return" value="index.php?action=success"/>
<input type="hidden" name="notify_url" value="index.php?action=ipn"/>
<input type="hidden" name="cancel_return" value=""/>
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cn" value="Additional Information"/>
<input type="hidden" name="currency_code" value="AUD"/>
<input type="hidden" name="bn" value="PP-ShopCartBF"/>
</form>
I am successfully returning to the URL after payment. and there I am just trying to print the POST Variable for now and It is not giving me any values.I have tried by both enabling and disabling 'auto return'. In both case I don't get values. Please help me, thanks in advance.
The "notify_url" will be contacted by paypal asynchronously (directly), without you having anything to do with this transaction. So you will never see in your browser any results whatsoever. You should use some kind of logging in your script to see what is actually being sent. Check your web server's access log to see if paypal is actually contacting your script (and make sure it's not "localhost" you're trying from)
If I remember correctly only the transaction id is sent back to the return_url. The notify_url receives that id also. From there you should be able to communicate both pages to fill your needs.
I am using this code to create my subscription for PayPal.
But it is not recognizing any of my input fields. Would you be able to shed some light on why not?
<form method="POST" name="gateway_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="business" value="EMAIL"/>
<input type="hidden" name="currency_code" value="CAD"/>
<input type="hidden" name="return" value="http://www.URL.com/payment/paypal_success.php"/>
<input type="hidden" name="cancel_return" value="http://www.URL.com/payment/paypal_failure.php"/>
<input type="hidden" name="notify_url" value="http://www.URL.com/payment/paypal_ipn.php"/>
<input type="hidden" name="item_name" value="Monthly Subscription"/>
<input type="hidden" name="discount_amount" value="0.00"/>
<input type="hidden" name="a3" value="49.00"/>
<input type="hidden" name="t3" value="M"/>
<input type="hidden" name="p3" value="30"/>
<input type="hidden" name="src" value="1"/>
<input type="hidden" name="sra" value="1"/>
<input type="hidden" name="srt" value="1"/>
<input type="submit" value="Click Here"></p>
</form>
You need to tell PayPal who is submitting the request by submitting the required URL parameters user, pwd, version, and (recommended but optional) signature, along with the other parameters you're sending in the POST request. See API Overview.
Take a look at this link:
Subscriptions and Recurring Payments Variables
https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside
Also, I suggest you use a hosted button. It makes the whole process very easy.
Well both you guys were right, but the issue that came about was because on my 3rd line there
<input type="hidden" name="cmd" value="_xclick"/>
needs to become
<input type="hidden" name="cmd" value="_xclick-subscriptions"/>
Thanks for your help!
I am using PayPal Website Payment Standard with IPN enabled.
Before I was setting cmd variable like this
<input type="hidden" name="cmd" value="_xclick">
but then I canged it to
<input type="hidden" name="cmd" value="_cart">
Also I changed some other variables inside my form
<input type="hidden" name="item_name_1" value="Item1">
<input type="hidden" name="amount_1" value="2">
<input type="hidden" name="item_name_2" value="Item2">
<input type="hidden" name="amount_2" value="2">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="quantity_2" value="2">
<input type="hidden" name="item_number_1" value="121">
<input type="hidden" name="item_number_2" value="122">
But when the form is Posted to PayPal I am getting this error.
Thanks in Advance...
did you add target="paypal" in the form opening tag?
could you show the entire form?
I think that you have to include the upload variable to identify the form as a cart:
<input type="hidden" name="upload" value="1">