hosted button with variable item_number. is this possible?

Kmart
Contributor
Contributor

I am trying to update an old website's paypal buttons.  The site sells many different products but many are all the same price/shipping.  For example, there are are about 50 items at 99 cents, 50 items at 1.99, etc.  I'd like to use a hosted button for each "class" of product and pass a different item name and number for each specific product.  This seems to work fine for changing the item name, using a hidden input with name="item_name" and whatever I want the value to be.  But it won't seem to work for the item number.  No matter what I pass as the item number thru my forms hidden input with name="item_number", the item number remains as whatever was set when I created the button (either blank or a dummy number) in the shopping cart.  I thought the item_number was supposed to be a pass through value?  Is what I am attempting to do not possible?  Or is there something different I need to do to tell the hosted button to allow a different value to be passed for the item_number?

Login to Me Too
3 REPLIES 3

angelleye
Advisor
Advisor

When using hosted buttons there are a very limited number of variables that will pass through.  Most everything will be ignored and fall to whatever was set in the hosted button.  Did you create all of these buttons manually or did you use the Button Manager API?

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

Kmart
Contributor
Contributor

What I wanted to do originally was create hosted buttons for each "class" of product where the amount and shipping would be set and I could pass a different item_name and item_number for each item in that class to have that information show up in the cart.  But it didn't seem that paypal would allow overriding the item_number, only the item_name.  The item_number displayed was always what was set when the hosted button was created, either blank or some dummy value.  I considered including the item number as an option for each item, but I didn't like how that looked, potentially getting grouped with other real options for an item.  So I switched to using php and the button manager API to generate an encrypted but not hosted button for each item dynamically.  I think this is the best that can be done to secure the item information until a total overhaul can be done, maybe using a 3rd party ecommerce database/shopping cart and only using paypal for checkout and payment processing.

 

It was disappointing that this couldn't be done but when I thought about it more I realized that allowing the item number to be overridden could potentially compromise the security of the buttons, as someone could alter the item number submitted to be something in a different class and that would effectively be the same as letting them alter the amount or shipping costs.

Login to Me Too

angelleye
Advisor
Advisor

Since you're comfortable with some coding, my recommendation would be to build your own basic shopping cart and use the Express Checkout APIs.  This will free you up to do anything you need to do.  If you're working with PHP my PayPal class library will make those API calls very quick and easy for you.

 

Another option would be to use something like WordPress with WooCommerce.  Have you looked into that?  It really sounds like it would be a good solution for you based on what you've explained, and it would eliminate pretty much any limitations with how you want to handle things.  If that case you could install WP + WooCommerce + PayPal for WooCommerce, and configure Express Checkout within that.  

 

If you use any of our tools I can get you a PayPal Pro account without any monthly fee, so then you could enable that using our library or WP plugins as well. Contact me directly if you would like more information about that.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.