Cannot get Paypal subscribe button to work - paypal

I am trying to implement a simple subscribe button using Paypal.
I have used their button generator and then copy pasted that code into my webpage.
The form looks perfectly fine and when I select a package and then click subscribe I need to login to Paypal which also works but then I get this error:
The link you used to access the PayPal system is invalid. Check the link and try again.
This is my button code. What is wrong?
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXX">
<table>
<tr><td><input type="hidden" name="on0" value="Packages">Packages</td></tr><tr><td><select name="os0">
<option value="Donor">Donor: $5,00 USD</option>
<option value="Vip">Vip: $10,00 USD</option>
<option value="Svip">Svip: $15,00 USD</option>
<option value="Elite">Elite: $20,00 USD</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Minecraft username">Minecraft username</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/sv_SE/i/scr/pixel.gif" width="1" height="1">
</form>

Forgot to fill in all settings for my Paypal Company account. Works fine now with above code.

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>

I am trying to redirect to paypal from my site http:\\www.abc.com and it doesn't work

I am trying to redirect to paypal from my site http:\www.abc.com and it doesn't work and shows message like To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.
Anyone can tell what is this issue for?
Here is a code example directly from the PayPal Developer Site:
For PayPal Button Manager API Overview click here
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="19218">
<table>
<tr><td><input type="hidden" name="on0" value="Color">Color</td></tr><tr><td><select name="os0">
<option value="Red">Red $10.00
<option value="Blue">Blue $8.00
<option value="Green">Green $12.00
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Size">Size</td></tr><tr><td><select name="os1">
<option value="Small">Small
<option value="Large">Large
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

PayPal Subscribe button with modify - I am breaking it somehow - how?

When I set modify=1 as below and click the button I don't get the advertised behaviour of being taken to a PayPal page where I can upgrade my (the test user's) existing subscription. Instead I just get presented with a new subscription, which doesn't cancel the old one if I agree. I'm sending some extra stuff as well and I figure something there must be breaking it ... but what?
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" name="subscribe_XXXXXX" id="subscribe_XXXXXX" style="float: left;">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="bn" value="XXXXXX" />
<input type="hidden" name="custom" value="XXXXXX" />
<input type="hidden" name="image_url" value="XXXXXX" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="notify_url" value="XXXXXX" />
<input type="hidden" name="return" value="XXXXXX" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="cbt" value="XXXXXX" />
<input type="hidden" name="src" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="hosted_button_id" value="XXXXXX" />
<input type="hidden" name="item_name" value="XXXXXX" />
<input type="hidden" name="modify" value="1" />
<input type="hidden" name="on0" value="Subscription options" />
<input type="hidden" name="on1" value="email" />
<table>
<tbody>
<tr>
<td>Subscription options:</td>
<td>
<select name="os0">
<option value="Daily">Daily: </option>
<option value="Weekly">Weekly: </option>
<option value="Montly">Monthly: </option>
<option value="Yearly">Yearly: </option>
</select>
</td>
<td>
<input type="text" name="os1" maxlength="200"/>
</td>
<td>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" title="Subscribe to CognitiveLab ICND1" alt="PayPal - The safer, easier way to pay online!" width="96" height="30" /><img alt="|" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</td>
</tr>
</tbody>
</table>
</form>
All the URLs are correct and work properly. I've also tried modify=2, and I am setting modify=0 if I know that the user isn't subscribed.
I am expecting this to result in a subscr_modify IPN with a revised period[123] and mc_amount[123] and a subscr_effective date. It doesn't, I get a new subscr_signup.
Try creating an unhosted button. Some values in the form aren't allow to be used when the preset values are saved within the PayPal account.
When creating the button add the steps below to obtain the "raw" HTML code.
Click "Step 2: Track inventory, profit & loss (optional)"
Uncheck "Save button at PayPal"
Once the button is created go ahead and click the link to remove code protection. If the issue continues please post the new form here and I'll take a look.
Hope this helps!

choose amount from dropdown list - paypal

I used the following code for my Donate button. When I choose amount in dropdown list and click Donate. It redirects to paypal site and asking me to enter the amount again but I already chosen amount in the dropdown list. Any help is appreciated. thanks.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<select name="amount" id="amount">
<option value="10">10 SEK</option>
<option value="20">20 SEK</option>
<option value="30">30 SEK</option>
<option value="40">40 SEK</option>
<option value="50">50 SEK</option>
</select>
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxxxxxx">
<input type="hidden" name="currency_code" id="currency_code" value="SEK">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_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>
When using hosted PayPal buttons you'll need to configure the drop down options in the button creation wizard. If you want to include all of that on your own you'll need to use non-hosted buttons.

PayPal Donation Button: Adding 'Amount' and 'Currency'

I have the "normal" PayPal donation button. I want to add two multiple choice fields: Amount and Currency as the image below. So the user dont need to put the amount of the PayPal website:
This is the 'normal paypal donation button code':
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXXXXXXXXX">
<input type="image" src="https://www.paypalobjects.com/es_ES/ES/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
</form>
I have read on this post that you have to add the following lines, but I dont know where or how to do it. It doesnt work.
<label for="amount">Select the amount you wish to donate:</label>
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select>
Can anyone tell me how to do it correctly? Thanks!
Hosted PayPal buttons allow you to send option variables, but when not for a donation button, be sure that the option values (for drop downs / text boxes) match exactly what is saved in your PayPal account. i.e. do not edit drop down boxes PayPal creates for you.
As for adding drop down boxes / text boxes to a hosted button, perfectly possible, as long as they do not alter the payment amount. So, for creating a hosted donation button that allows you to edit the amount, I advise the following:
Create a buy now button on PayPal, adding the drop down boxes and/or text boxes you wish to add to your donation button. Create this button as if you were creating your donation button, because that is exactly what we will be doing, changing this button into a donation button.
Copy the the whole buy now button HTML code, paste into notepad, or an editor where you can use 'find and replace'.
Replace all occurances of 'buynow' with 'donate' (This usually just changes the image). Also, replace '_xclick' with '_donations'. (to tell PayPal how to generate the checkout page)
You now have a donation button
I had the similar problem, I solved it by the following steps:
Created a basic 'Buy Now' button (without any options or text fields, just the bare button), made sure i unchecked 'save button at PayPal' before clicking 'create button'.
Then After the button is created, and code is generated, clicked 'Remove code protection' on the top-right where the generated code is shown.
added one additional text input with name 'amount'
replaced value _xclick with _donations (on the input field with name='cmd')
the result is the following code, and it works for me (for now) (you need to add some validations though)
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="XXXXXXXXXXXXX">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Sample Name Here">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHosted">
<input type="hidden" name="on0" value="Donate">
<input type="text" name="amount" value="23.00">
<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" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Paypal has specific HTML data requirements when you post to their page.
The 'host_button_id' can only be used for one specific value and it's data that paypal holds on their site as a convenience to their clients.
In order to pass variable data you have to pass all the information they need. The 'host_button_id' is no longer needed.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="herschelgomez#xyzzyu.com">
<label for="amount">Select the amount you wish to donate:</label>
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select><br/>
<label for="currency_code">Select the currency:</label>
<select name="currency_code" id="currency_code">
<option value="USD">USD</option>
<option value="GBP">GBP</option>
<option value="CAD">CAD</option>
</select><br/>
<input type="hidden" name="currency_code" value="USD">
<input type="image"
src="https://www.paypalobjects.com/es_ES/ES/i/btn/btn_donateCC_LG.gif" border="0"
name="submit" alt="PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif"
width="1" height="1">
</form>
You can find more currency codes here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_currency_codes
and more html info here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_buynow_buttons#id08A2G0920QN
Also for the hidden 'cmd' I'm not sure if that will have to change to '_xclick' only. You'll have to test it out and see what works.
Please try this :
<head>
<title>Get Selected Item - DevCurry.com</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
$(function () {
$('#ddl').change(function () {
$('#divone').text($(this).find(":selected").val());
});
});
</script>
</head>
<body>
<select id="ddl">
<option value="Tomatoes">Tomatoes</option>
<option value="Potatoes">Potatoes</option>
<option value="Onion">Onion</option>
<option value="Olives">Olives</option>
</select>
<br />
<div id="divone" />
<input type="hidden" id="txt" />
</body>
</html>