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.
Related
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="business" value="dummy#example.com">
<input type="hidden" name="cmd" value="_xclick-auto-billing" /> <!-- _xclick-subscriptions works here -->
<input type="hidden" name="a3" value="1" />
<input type="hidden" name="p3" value="12" />
<input type="hidden" name="t3" value="M" />
<input type="hidden" name="src" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="submit" name="submit" />
<input type="hidden" value="PP-SubscriptionsBF" name="bn">
</form>
I was trying to find out what the differences are between _xclick-subscriptions and _xclick-auto-billing. Above form works when the cmd value is _xclick-subscriptions. However, when I replace it with _xclick-auto-billing, Paypal returns an error page saying "item amount" is incorrect. I check Paypal's documentation but there isn't much explanation or example about _xclick-auto-billing. So how should I use this cmd and what are the differences?
In general, auto-billing should not be used unless you are able to generate a sample auto billing button via https://www.paypal.com/buttons
When doing so, uncheck the option in section 2 to save the button at PayPal. When viewing the generated code, click the option to remove the code protection. Then you will have sample working HTML that you can adapt to your needs.
If you cannot create such a button, it is because your account does not support it. Subscriptions are much more widely supported and should be used instead, generally speaking.
Instead of the old-style Subscribe button, consider the new Smart Payment Buttons which use plans and products as a base and offer a much more modern checkout experience. See https://www.paypal.com/billing/plans
I have different products in my site to sell.
The problem is that each time for new product i have to manually create a new form using paypal and implement it in site which takes a lot time.While purchase i need two information from customers their email and phone no. .So is there any way to do this by creating a non-hosted paypal form.Can we add text-fields in non-hosted paypal forms?
For Example:(below is non-hosted paypal form how can i add two text fields to it and get them show up in customers purchase detail in paypal)
<div style="width:300px;background-color: #FFFFFF">
<h2 style="text-align:center">
Type in title here</h2>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypal_form">
<h3 style="text-align:center">
Yummy Logo for $90</h3>
<p align="center">
<input type="submit" value="Buy" /></p>
<input name="cmd" type="hidden" value="_xclick" />
<input name="business" type="hidden" value="my_paypal_email#example.com" />
<input name="item_name" type="hidden" value="logo type x2" />
<input name="amount" type="hidden" value="2" />
<input name="no_shipping" type="hidden" value="1" />
<input name="no_note" type="hidden" value="0" />
<input name="cn" type="hidden" value="Client Comments:" />
<input name="return" type="hidden" value="http://example.com" />
<input name="cancel_return" type="hidden" value="http://example.com" />
<input name="rm" type="hidden" value="1" />
<input name="currency_code" type="hidden" value="USD" />
</form>
</div>
<p>
</p>
Check out HTML Variables for Filling Out PayPal Checkout Pages Automatically.
I have a form that adds items to a cart. But I want to give them an option to ship the item to a store.
My form looks like this...
<form action="https://www.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="XXXXXXXXXXXXXX" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="amount_1" value="19.99" />
<input type="hidden" name="item_name_1" value="MyCoolTshirt" />
<input type="hidden" name="quantity_1" value="2" />
<input type="image" src="Checkout-Button.jpg" name="submit" alt="cart add" />
</form>
Can I add a code in there that will deliver the comment to me, indicating "Ship to store" so customer can pickup instead of shipping it to them?
You can take a look at the standard variables list to see what all is available for you to use. There are a few different things you could do.
You could save everything into your local database first, complete with all notes or anything you'd want to reference. Then you can pass that "invoice ID" into the invoice parameter of your form, and you would always be able to relate back and pull that data from your own system.
You could also just use the "custom" parameter to pass anything you want up to 255 characters.
I'd browse through that list, though, as there could be lots of different things you decide you'd like to use.
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.