Passing Donation Amount to PayPal Page - paypal

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>

Related

PayPal Not Passing Amount For Donation

I'm building a website for a client that has to take donations. I want to have the donation value passed through and automatically filled when they land on PayPal. I have two different sets of code with two different errors.
I do not have access to my clients PayPal account so please let me know if it's not solvable on my end. I do have their merchant ID, which has been redacted in the below code with "merchantidgoeshere".
Code 1: Goes To Merchant Donation Form But Doesn't Pass The Value
<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="merchantidnumberhere" />
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="amount" value="15.00">
<br /><input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>
Code 2: Doesn't Go To Page And Redirects To Error Page With The Message:
We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.
<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="merchantidnumberhere" />
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="amount" value="15.00">
<br /><input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>
The first button is a hosted button, so the amount details would have to be set at in the button wizard within the PayPal account. You won't be able to pass your own dynamic value using a hosted button.
The second one is working fine for me when I replace "merchantidnumberhere" with a valid account email address. Did you make sure to update the business parameter with a valid email address or account ID?
Just as a note, to force English as the language the code shouldn't be:
<input type="hidden" name="lc" value="US">
It should be:
<input type="hidden" name="lc" value="en_US">
Cheers from Spain!

Create a paypal donate button with a dynamic notification url?

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>

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.

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.

Automatically tick 'Make this recurring (monthly)'

I've got a donate page on a website I'm building for a charity. On the page they want to have two options: 'Donate' and 'Donate monthly'. These buttons should take you straight to the donations page on PayPal, however the client wants the 'Donate monthly' button to make the 'make this recurring (monthly)' box on the paypal site itself, pre-ticked.
Is there a way to do this by passing a parameter? Either via Query string or hidden input. Here is the code as it stands at the moment:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="paypal#clientemail.org">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Client Name">
<input type="hidden" name="item_number" value="Donate">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-DonationsBF:donateBtnPaypal.png:NonHostedGuest">
<input class="btn shorter diavlo book" type="submit" value="Donate monthly (€)" 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>
What you could do is switch to the Express Checkout API. This would give you the ability to design those options into your own UI and pass it all over to PayPal however you want to.
If you're working with PHP my class library for PayPal will make it very easy on you. Specifically, you would be using:
SetExpressCheckout
GetExpressCheckoutDetails
DoExpressCheckoutPayment
CreateRecurringPaymentsProfile
No, its not possible to make it as default option "Make This Recurring (Monthly)"