Create a paypal donate button with a dynamic notification url? - paypal

I have been bashing my head against the Paypal developer portal. Its missing information, has out of date information or links just go to 404s. I am trying to do something really simple.
I am trying to create a basic button with a notification url including a custom parameter.
eg:
www.mydomain.com/paypalipn.html?clientID=1232312321
Every time I create the button in the sandbox portal it creates an uncustomizable HTML button as per so:
<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="HFYXEE3BN8RM2">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" 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>
Is there a way to customize the notification url using a Paypal button to add the parameter in the code?

You are creating a hosted button, in which you cannot have a dynamic URL. You will need to create a non-hosted/decrypted button in order to use dynamic IPN URL.
Eg:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="your_email.com">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="notify_url" value="http://www.yourdynamicIPNurl/ipn_code.php">
<input type="hidden" name="amount" value="1.00">
<input type="image" src="https://www.paypalobjects.com/en_AU/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>

Related

Passing Donation Amount to PayPal Page

In the past I was able to add a form so a user could add a donation amount on the website and it would send that amount to the PayPal checkout page. It seems that PayPal has changed how this works and I am having issues figuring out how to pass that amount. I am hoping someone here has gotten this to work. Here is my current code and dev site for testing purposes.
<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="hosted_button_id" value="VMUWQGHWEATL8" />
<input type="hidden" name="currency_code" value="USD">
<!-- Text Input Boxes -->
<div class="donate-wrapper">
<input type="text" id="amount" name="amount">
<p style="color: #fff">Monthly donation options on the next screen.</p>
<input type="submit" name="submit" value="continue" alt="PayPal - The safer, easier way to pay online!">
</div>
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
Dev site: https://braindonordev.wpengine.com/support-us/
You can do it. Create a new button via http://www.paypal.com/buttons , and in Step 2 uncheck the option to save the button at PayPal. Then when you have generated your button code, click the option to remove the code protection.
Now you have "unhosted" HTML you can edit.
The unfortunate thing when passing a donation amount is there won't be an option to make the donation recurring, so you would need a separate relabeled "Subscribe" button for that. Relabled meaning, replace the image with one that says "Donate".
Alternatively, just keep the basic Donate button that you have to serve both use cases (recurring and non-recurring). It's intuitive enough, and has a nice big amount box on the next screen and checkbox to make it recurring:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="paypal#redcross.org">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="text" name="amount">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_donateCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

How do I track a Paypal button click using Google Analytics event triggars

I'm trying to track in Google Analytics whenever a user clicks on a Paypal payment button. I have an event tracker set-up, but currently no event is being triggered when the button is clicked. Here is the paypal form with an onclick event trigger.
<form onclick="_trackEvent('buttonclick', 'buttonclick');" action="https://www.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="ZDHHMPA9CQR54">
<input type="image" id="imageH" style="width:90%" src="http://roadcams.net/wp-content/uploads/2015/09/buttons2.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Any help would be appreciated.
If you're using the latest version of google analytics, you need a different function:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
so yours might be...
<form onclick="ga('send', 'event', 'button', 'click', 'paypal');" action="https://www.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="ZDHHMPA9CQR54">
<input type="image" id="imageH" style="width:90%" src="http://roadcams.net/wp-content/uploads/2015/09/buttons2.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

PayPal button with custom amount

I'm trying to add a PayPal 'Buy Now' button to my website. Because the price of my product is customer per order I need to pass in custom amount which is pulled in by the variable {{ order.invoiceValue }}. My code snippet is below, but it does not seem to be recognized by PayPal (see screenshot below). Any help would be appreciated!
<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="XXXYYYZZZ">
<input type="hidden" name="business" value="service#mycompany.com">
<input type="hidden" name="amount" value="{{ order.invoiceValue }}">
<input type="hidden" name="quantity" value="1">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0"`enter code here` src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
You do not need to add the code {{ order.invoiceValue }}. Instead, just leave the value as a blank. When your customers put the amount, the price it will be passed to PP.

Getting a "Some required information missing" error testing a PayPal form

Getting error: Some required information missing from using this form:
<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="custom" value="$id">
<input type="hidden" name="hosted_button_id" value="PGZ7LZ2K66GLQ">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
What information have I left out?
Something is wrong with your hosted button id.May be wrong characters or you are using a LIVE paypal account hosted id.
You could try to generate new button.I just replaced the hosted button id with mine and it works.
<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="custom" value="3434">
<input type="hidden" name="hosted_button_id" value="DG2WCMX8VL59Q">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

How to integrate paypal button that accepts credit cards and has specific label?

I have a website and want to add a PayPal button so that people can buy staff.
I want to:
1) Add a PayPal button to my website but I want it also TO ACCEPT CREDIT CARDS
2) Change the label. e.g.https://developer.paypal.com/docs/classic/api/buttons/
I have browsed dozens of explanations pages but they are all not focused and don't really prompt what to do.
Can anyone help hpw to do these?
Thanks!
PayPal has default settings where the credit card acceptance would be relative to your account/the button type/and a risk assessment. This might be something better to call in and speak with an agent who would have your account details.
Here is some sample code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="youremail#youremail.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Pay Now">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="weight_unit" value="lbs">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynowCC_LG.gif:NonHosted">
<table>
<tr><td><center>
<input type="text" name="amount"><br>
</center></tr></td>
<tr><td><center>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</center></tr></td>
</table>
</form>
You would want to change this line:
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"
This is the image URL. If you change the URL there to the URL of the image you are looking to use than it will reflect on the site.
I believe this is what you are looking for.