Can't find a "Buy Now" button option to fit my site's needs

Technetium
Contributor
Contributor
I have a site that allows users to add items to a cart, and at the checkout, I want to include a "Buy Now" button that will let them complete the purchase on Paypal. I have written the code for the cart and checkout page myself. The problem is that there doesn't seem to be a way to create the Paypal Buy Now button dynamically as the page is loaded, so that it can simply have a price that is the sum of the items in the cart. The button generation page requires you to either define a single price for the Buy Now button , or a list of drop-down choices, and these have to be defined before you even put the code for the button on the page. Not sure how to proceed from here, thanks in advance for any assistance. This part of the site is not live yet, so I unfortunately can't demonstrate, but it's not that different from how the cart of a site like amazon.com works.
Login to Me Too
5 REPLIES 5

snowshoe
Frequent Advisor
Frequent Advisor

What you have in mind cannot be done using the online button creator.  The code has to be manually generated and would require a bit of custom scripting to manage the logic you need.  As this forum is intended for less technical  issues, you may want to visit the Developer's Forum for a possible solution.

http://stackoverflow.com/questions/tagged/paypal

Login to Me Too

Technetium
Contributor
Contributor
Thanks. I tried the link to the developers forums at x.com (posted at the top of this forum page), but unfortunately it seems like that website is no longer in operation. I will try posting at stackexchange, I have used that site before for other matters.
Login to Me Too

PayPal_Erica
Moderator
Moderator

Hi Technetium,

 

x.com is now located at www.developer.paypal.com. 🙂 You can also file a ticket with our technicians at www.paypal.com/mts or chat with them on Twitter at @PayPal_MTS 

 

I hope this helps! Smiley Happy

 

-Erica

Login to Me Too

Technetium
Contributor
Contributor
I figured out how to do this and thought I would post here just in case anyone ever has the same issue. First, you need to uncheck the option to save the Button at paypal.com. This is in the "Inventory" section of the Button Generator. Then when it gives you the code for the Button, click the link "Remove Code Protection" so that you can see the actual content used. It will contain a lot of "hidden" input types, including for price. You can copy and paste this code to your PHP file and then rewrite it so that PHP is generating that price value based on the stored session variables.
Login to Me Too

snowshoe
Frequent Advisor
Frequent Advisor

Glad you figured it out ... in my previous post, I mentioned that the code had to be manually created.  Sorry I was not more specific.  Many times when coders need to dynamically change their item button code via PHP, even using the online button creator has limitations when it comes to generating the clear text code or non-hosted, non-encrypted, which is what you're now generating.   For example, some coders simply start from scratch while others will use the online button coder to save some time, then from there will add more option variables or checkboxes or radio buttons and toss in a bit of custom scripting to make it all work. 

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.