Reply to topic
stillbluewaters
stillbluewaters Contributor
Contributor
Posts: 10
Kudos: 0

Editing buttons on the fly.

This is not a question but rather some insight on creating a button which you can edit on the fly without creating a new on Paypal for each item your selling.

 

A lot of people want to use a manual html/java code for buttons for that reason but cannot seem to find the info.

 

There is help on Paypal and Merchant Services and Web Development and after much searching and putting it all together I came up with a solution, an editable custom code of my own. Here is it explained below. I hope this helps some of you. For this example, I'm using a shopping cart button. With this code, Paypal automatically generates a standard shopping cart. You can use custom checkout pages or add your logo, banner, etc to the cart by setting it up in your account Profile. (this example is a fictional company)

 

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="sales@tommysmusic.com">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="item_name" value="Alvarez 6-string Acoustic/Electric Guitar">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="amount" value="1495.00">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shopping_url" value="http://www.tommysmusic.com/guitars_A-E.html">
<input type="hidden" name="cancel_return" value="http://www.tommysmusic.com/index.html">
<input type="hidden" name="return" value="http://www.tommysmusic.com/thankyou.html">
<input type="image" name="addtocart" border="0" src="https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif" alt="add this item to your shopping cart">
</form>

 

It all breaks down like this:

 

Code calls up Paypal server with instructions:

 

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">

 

This one tells Paypal who's getting paid (business variable). Instead of using your Paypal account email, it's better to use your merchant id number, located at the top of your Account Profile page under your name but you can use your email address and it will work to send the funds from the sale to your account:


<input type="hidden" name="business" value="sales@tommysmusic.com">

 

This one tells PayPal that it's a shopping cart:
<input type="hidden" name="cmd" value="_cart">

 

This one instructs Paypal to add one (1) item to the shopping cart:
<input type="hidden" name="add" value="1">

 

This one gives the item description or title:
<input type="hidden" name="item_name" value="Alvarez 6-string Acoustic/Electric Guitar">

 

This one tells Paypal that there is only 1 item and not to sell it again. For more than one item, adjust the "value."
<input type="hidden" name="quantity" value="1">

This one tells what price to charge the customer:

<input type="hidden" name="amount" value="1495.00">

This one instructs how to charge shipping: (I offer free shipping so I use the "no_shipping" variable)

Value of "0" equals no shipping charges, customer address optional.

Value of "1" equals no shipping charges, do not collect customer address.

Value of "2" equals no shipping charges, customer address required.

<input type="hidden" name="no_shipping" value="2">

 

This one tells Paypal that the currency is United States Dollars:
<input type="hidden" name="currency_code" value="USD">

 

This one tells where to send the customer if they click "Continue Shopping" button in cart:
<input type="hidden" name="shopping_url" value="http://www.tommysmusic.com/guitars_A-E.html">

 

This one tells where to send the customer if they cancel their purchase or checkout:
<input type="hidden" name="cancel_return" value="http://www.tommysmusic.com/index.html">

 

This one tells where to send the customer after they complete their purchase and payment: It's a good idea to have a thank you or confirmation page that matches your site to bring the customer back to after checkout otherwise Paypal sends them to a Paypal page. I want them back on my site so I have a confirmation page set up.
<input type="hidden" name="return" value="http://www.tommysmusic.com/thankyou.html">

 

This one tells where to find the "Add to Cart" or "Buy" button: (I'm using the Paypal small button here. To use your own button, simply change the image file address (src variable) to your location and image file)
<input type="image" name="addtocart" border="0" src="https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif" alt="add this item to your shopping cart">


</form>

 

So now I have a working and workable button code which I can simply edit on the fly instead of creating new buttons on Paypal for each item.

 

If you need other code variables for different functions, you can find them here:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websit...

 

Each function will be listed as an input(<input). To use the code you only need to edit/change the "Value" variable in each code. In my code each input is "hidden." The only one to be displayed will be the image unless your using selection drop down menus or other "option"s such as size, color, etc. Those variables are found at the link above also.

 

It's just that easy. For other button or checkout features, refer to the link above. All the variables will work on all types of buttons (shopping cart, buy now, subscribe, donate, etc).

 

I hope this helps some of you. If you want, you can copy my code and edit it with your account id, items, prices, etc. It has been tested and it does work. Good luck.

 

Tommy

0 Kudos
maple
maple Member
Member
Posts: 3
Kudos: 0

Re: Editing buttons on the fly.

Thanks, stillbluewaters. I hope your info is correct. It would be a real time saver for anyone needing multiple buttons.

 

I would like to hear from anyone else tried this who can verify this does work. I found an old post with similar instructions, but was told by a user that it was out of date.

 

Anyone?

0 Kudos