How to add more information to PayPal button? - html

I created a paypal subscription button, but I do not know how to add id number for every product.
The code
<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="PULBECSY5HQ2W">
<input type="image" src="https://www.paypalobjects.com/en_US/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_US/i/scr/pixel.gif" width="1" height="1">
</form>
Any help with this is much appreciated.

This is a hosted button. You will not be able to add additional fields directly to the HTML for a hosted button. Instead, you'll need to make a non-hosted button by unchecking the box for Save at PayPal during the button creation procedure.
This will allow you to add as many standard variables as you want, but would not be as secure as a hosted button.
If you want full flexibility plus security you'll need to switch to using the APIs.

Related

Box In new page

I am trying to get a PayPal link/button to open on another page instead of opening on the same page. It is an old site so I was looking for the best way to update it. The link is as follows. Thanks in advance!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="XXXXX" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></form>
With that old style button code, you can accomplish what you want by changing target="_top" to target="paypal" (or _blank)
However, the best solution would be to change to using a smart button, which uses an in-context approval flow rather than a separate browser tab. You can create one for your account via https://www.paypal.com/buttons , first option
(There's also a code demo here, and full documentation here)
Simply change your target to target="_blank" rel="noopener noreferrer". The target _blank opens a new tab for you without closing the original. noopener and noreferrer is a good security measure.

Paypal Multi currencies button buy

I created several buttons buy on Paypal with different currency.
Do you think, is it possible to create one by compiling the codes?
However, I'm a beginner in coding so...I'm a bit lost.
Button buy on paypal code is :
<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="XXXXCURRENCY">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_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 would like to configure a currency selection. I meant, if the buyer wants to buy in $ for example, he will select the currency and press the button buy for going to the paypal product in $
If the buyer wants to buy in € for example, he will select the currency and press the button buy for going to the paypal product in €
Currency:
<select name="currency_code">
<option value="EUR">EUR €</option>
<option value="USD" selected>USD $</option>
</select>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_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">
Where I need to put this 2 lines?
<input type="hidden" name="hosted_button_id" value="xxxxUS">
<input type="hidden" name="hosted_button_id" value="xxxxEUR">
Thank you so much for your help
For this, create an unhosted button.
Go to https://www.paypal.com/buttons , Buy Now button, set your options, and in Step 2 uncheck the option to 'Save your button at PayPal.
When your code is generated, click the option above to remove code protection.
Now all you need is a single <select> input to change the currency_code. There will be no hosted_button_id

Setting "Note" field in PayPal Donation Form via PayPal Button

I'm trying to set the "write a note" field (which appears in the PayPal donation form) programmatically via a PayPal button. The field can be seen here.
According to the current documentation, it looks like I need to just assign a value to the item_name variable. I have the following HTML, but it doesn't seem to do the trick:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="xxx#xxxxx.com">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="item_name" value="hellooo!!!">
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" />
</form>
Note: this code previous worked on the older version of the Donation form. Could this be a breaking change?
With the newer version of the Website Payments Standard checkout flow the "note to seller" is no longer a supported feature.
A workaround for this would be to use an "option variable" to create a textbox in your checkout flow. An example of an option variable would be "os0" and "on0".
Here is an example on our website on how you would implement this: https://www.paypal.com/us/cgi-bin/webscr?cmd=_pdn_xclick_options_help_outside
Here is another link to HTML variable guide:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Please let me know if you have any more questions!

Paypal Button For Google Chrome Extension

I'm attempting to add a donate button (because I like money) to my google chrome extension. I'm having trouble with it because the Chrome extension tries to open the paypal created donation button in the popup.html window. When I click the button, my extension just restarts and there is no donation window.
I have tried using chrome.tab.create() to try to make it open to a tab but it doesn't seem to have any effect.
The code to the donation button is as follows:
<form action="chrome.tabs.create ({'url': '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="XXXXXXXX">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_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_US/i/scr/pixel.gif" width="1" height="1">
Any help with this would be great!
Thanks
Try a link instead of a form: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxxx
Instead of:
<form action="chrome.tabs.create ({'url': 'https://www.paypal.com/cgi-bin/webscr'});" method="post">
Try:
<form action="https://www.paypal.com/cgi-bin/webscr" target="_blank" method="post">
To add on to PayPal_Robert:
If you still want the PayPal donate image linked in there, try:
<a target='_blank' href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxxxx'>
<image src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0">
</a>
Just change the hosted_button_id parameter to your own.

PayPal Button As Text Link

Can anyone please tell me how to change a PayPal buy button to a text link? Thanks. Here is the 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="XXX">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_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>
Did you try this?
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XXX
You need to replace XXX of course.
The HTML-Code would look like this:
Your Text
For example one with working button id:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7865
Paypal has a builder for doing this. Login to your paypal account. Click on 'Merchant Services'. Choose the button type you want (payment, subscription, etc). Run through the rest of the options. It will generate the button as a form but there is a tab at the top to have it generated as a link. The tab is titled "Email".
After you have created a button, there will be an email link. You can use this as an href="https://www.paypal.com/examplecode/ExampleButtonID".
Check out this Paypal Link Generator.
http://www.blogbyben.com/2009/04/paypal-link-generator-build-your-own-1.html
It does appear that PayPal basically forces you to use an image as the link because it allows them to encrypt some of the data that is sent. Check out "Protecting HTML Code for Payment Buttons" on page 90 of https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_websitepaymentsstandard_integrationguide.pdf
The code you need is:
Text goes here
Replace XXX with whatever your button code is and replace Text goes here with whatever text you wish to show.
The XXX is the hosted button ID, which is usually a 13 character value such as H6C28LJRV72J2.
One solution that has not been posted is for the donate link. Hopefully someone finds this helpful. In addition to what #1' OR 1 -- provided, you can use the below for a text link for donations:
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=INFO#EMAIL.COM&lc=US&item_name=Donation+to+YOUR+BUSINESS+NAME&no_note=0&cn=&curency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted
You'll want to replace INFO#EMAIL.com and Donation+to+YOUR+BUSINESS+NAME with your own information, as well as possibly change currency code.
What about this:
<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="XXX">
<input type="submit" value="submit" 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>
This will give you a button with text.