I am having trouble here with my paypal form. What I am trying to do is set it up so for every 50 in quantity, they get 5 free. Is there away to do this with the discounts?
<input type="hidden" name="amount" value="9.00">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="discount_amount" value="0" />
<input type="hidden" name="discount_rate" value="1" />
<input type="hidden" name="discount_num" value="5" />
I'm afraid PayPal Website Payment Standard could not meet your request perfectly. You may have to write some JavaScript to generate the value of discount_amount dynamically.
Related
being a PP developer newbie, I used the PayPal documentation to set up this Business Starter integration:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="info#mybusiness.com" />
<input type="hidden" name="item_name_1" value="My product 1" />
<input type="hidden" name="amount_1" value="10" />
<input type="hidden" name="quantity_1" value="2" />
<input type="hidden" name="display" value="1" />
<input type="hidden" name="return" value="http://www.mybusiness.com/cgi-bin/gk.cgi?ppstatus=ppy" />
<input type="hidden" name="cancel_return" value="http://www.mybusiness.com//cgi-bin/gk.cgi?ppstatus=ppn" />
<input type="hidden" name="cbt" value="Back to MyBusiness" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="custom" value="MyID" />
<input name="submit" type="image" id="submit" src="../pics/b-pp_01.gif" width="200" height="30" border="0">
</form>
All I get after sending this form away is a blank page with the URL https://www.paypal.com/cgi-bin/webscr
Where did I go wrong?
Thanks for any help,
Emil
There are a few issues with your button (e.g. you don't specify a total amount; I don't think you are doing what you think you are doing with the custom field; etc.) but to start with: you are giving PayPal two different commands (cmd=_cart, cmd=_s_xclick), and likely neither of them is what you want. _cart is for using the PayPal cart, which is a little-used PayPal product where the cart is maintained by PayPal, not on your site. And _s-xclick is for secure, ie encrypted buttons, which you are not doing (your cart fields being plaintext in the form html).
Here's one overview of the button docs:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
... that I hope can help, but ultimately get the reference guide for the particular product you are trying to use, specify only that cmd, and use only the field supported by that product. I also recommend using one of PayPal's (non-javascript) button generators to generate your first few buttons, thus guaranteeing that you are getting valid button html, and then modifying from there rather than trying to write from scratch. Helps get you on the right path.
I'm trying to integrate Paypal payments on website and I got this form:
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" id="paypal_form">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="mail#mail.com" />
<input type="hidden" name="item_name" value="Test payment" />
<input type="hidden" name="item_number" value="777" />
<input type="hidden" name="amount" value="1.99" />
<input type="hidden" name="return" value="http://myhost.com//successpaypal.php" />
<input type="hidden" name="cancel_return" value="http://myhost.com/cancelpaypal.php" />
<input type="hidden" name="no_shipping" value="0" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="currency_code" value="USD" />
<input type="submit" value="Go to PayPal" />
</form>
And payments goes fine until users needs to confirm payment. There is no e-mail sending. I was trying in the sandbox with couple e-mail from couple computers and a couple of days. Is there any way to remove confirmation of payment by e-mail or what can be wrong with my that form?
The sandbox environment doesn't send emails externally. Since anyone can open (and confirm) any email address on any account in sandbox, it would be total chaos.
Instead, you can find all relevant messages that otherwise would've been sent as emails under 'Dashboard' > 'Sandbox notifications' on https://developer.paypal.com/
I am trying to set up PayPal's IPN for custom cart use. But somehow it does not work. Can you guys have a look at the PayPal button code I am using? Do you notice any problems? Once I click on the Pay button, I am taking to PayPal's page that has the follow message:
We have detected a problem with this shopping cart. If the problem persists, please contact the merchant.
Questions:
What is the right way to name these variables: item_numberX or item_number_X? And the same with variables responsible for: price, name, and quantity. Do I need to add the underscore?
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="item_name_1" value="Service 1">
<input type="hidden" name="amount_1" value="148.00">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="mc_gross_1" value="148">
<input type="hidden" name="item_number_2" value="2">
<input type="hidden" name="item_name_2" value="Service 2">
<input type="hidden" name="amount_2" value="30.00">
<input type="hidden" name="quantity_2" value="1">
<input type="hidden" name="mc_gross_2" value="30">
<input type="hidden" name="return" value="http://www.sitename.com/thank-you/">
<input type="hidden" name="notify_url" value="http://www.sitename.com/ipn.php">
<input type="hidden" name="first_name" value="Peter" />
<input type="hidden" name="last_name" value="James" />
<input type="hidden" name="payer_email" value="alex111#gmail.com" />
<input type="hidden" name="item_number" value="144" / >
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"
border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
Thank you.
You have most of the button right, the only variables I see issues with are "mc_gross_x", "payer_email" and "item_number". I am not sure where you got mc_gross_x at, but this would not be used in a button, you may have it confused with an IPN variable. As for payer_email, again you may have this confused with an IPN variable. If you are trying to populate the buyers email address on the PayPal payment page, it would just be "email". Also, you do not need to pass "item_number", since you are using the cart upload method, you would just use the format that you are already using up above in your code"item_number_x".
If the button still does not work for you, I would need to see the rest of the bottom code to see why it is not working.
I have just began working on a project processing paypal payment on a web site, which does not work fine in the sense that the email notification is sent if and only if the user goes back to the site. The fact is that I didn't code it and I even don't know what kind of api it uses. I read the doc which is quite obscure to me (It understood there is a token needs to be sent from the site by get request method but I am really not sure). I understand from the code that, in the following, the op=dodons uri is used to mange the response of paypal and to send an email notification to the user. Here is the only thing I can tell you about the page from which I want to fetch up how the payment is processed :
<form action="{$payPalURL}" method="post" class="payPalForm" id="frmpp">
<input type="hidden" name="cmd" value="_donations" id="typedon"/>
<input type="hidden" name="item_name" value="Donation" />
<input type="hidden" name="business" value="{$myPayPalEmail}" />
<input type="hidden" name="notify_url" value="{$url}/index.php?op=dodons&donation=1&tid={$randomID}&payment=1" />
<input type="hidden" name="return" value="{$url}index.php?page=campaign&op=dodons&campaign_id={$campaign->getId()}&don=ok" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="cbt" value="Continue" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="txn_id" value="{$randomID}" />
<input type="hidden" name="tid" value="{$randomID}" />
{if $logged_user != null}
<input type="hidden" name="a_id" value="{$logged_user->getId()}" />
</form>
It looks like you're using Payments Standard in combination with Payment Data Transfer (PDT).
PDT only works if the user makes it back to the site which is never guaranteed, even with Auto-Return enabled.
Instead, use Instant Payment Notification (IPN). This is a simple POST of all transaction data to a listener script on your server, and this happens regardless of whether or not the user makes it back to your site or not. It's completely separate from the checkout flow.
what's the best way to simply get feedback from PayPal to confirm that your customer paid? It looks as if the answer is IPN - if so, my followup question is, can I enable IPN for only specific buttons? I don't want PayPal pinging my IPN listener for purchases that don't require any kind of IPN integration.
I'm all about Agile and YAGNI, and therefore I don't want to do anything that is unnecessary.
You should read the IPN Documentation that have provided by PayPal. To use IPN, the simple way is to have invoice id for a transaction that you want to track. In the IPN listener page, you will get ipn_data and one of the field is the invoice. Using this id, you should get the data from your own transaction database, then change the status to reflect the payment status in PayPal.
In my code, usually I set status to unpaid, direct the user to paypal to do payment, and in IPN listener I will set the status to paid.
PayPal provide sample code so you can start right away. You can also see other PayPal documentation in this page.
You can easily include which IPN listener to use for in a button's parameters.
If you don't have a default location set on PayPal's website, then your IPN listener will only get pinged for those buttons that do have one set.
The PayPal form variable in question is "notify_url".
Here's an example subscription button, same variable for anything else though.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-butcc-subscribe.gif"
border="0" name="submit" alt="PayPal - The safer, easier way to pay online."
onclick="_gaq.push(['_trackEvent', 'Click', 'PayPalMonthSub', 'SubscribePage']);" />
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1"
height="1" />
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<input type="hidden" name="business" value="paypal#yourdomain.com" />
<input type="hidden" name="item_name" value=" Monthly Subscription" />
<input type="hidden" name="item_number" value="1" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-SubscriptionsBF" />
<input type="hidden" name="a3" value="4.99" />
<input type="hidden" name="p3" value="1" />
<input type="hidden" name="t3" value="M" />
<input type="hidden" name="src" value="1" />
<input type="hidden" name="sra" value="1" />
<input type="hidden" name="return" value="http://yourdomain.com/subscribe/thanks.aspx" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="cancel_return" value="http://yourdomain.com/subscribe" />
<input type="hidden" name="notify_url" value="/http://yourdomain.com/IPN.aspx" />
</form>
If you need the default notification url set on your account then you will only be able to stop your handler being pinged by including a different handler in buttons that don't need it. If PayPal doesn't get an HTTP200 from a handler though it will keep trying it so I wouldn't advise setting anything to a non existent URI.