0

I'm very soon looking to make a website with PayPal integration to handle payments. What I'm planning on doing is have two options; Option A which will cost $1 per "1" quantity and Option B which will cost $5 per "1" quantity.

So if a user picks Option B and a quantity of 20 the total cost will be $100.

How can I have a "Buy Now" button where the price "request" is whatever the total cost is (so in this case the price request will be $100).

Thank you.

1 Answer 1

1

That's a pretty wide open question, so this will probably be a pretty wide open answer.

You've got lots of options. Will you be working with PHP? do you JavaScript well? Both? You could build a form one page that POSTs to another page, and then dynamically output the PayPal checkout button with that form data.

If you wanna get more slick than that you could use some jQuery or any basic JavaScript to automatically update the values on the form so it doesn't have to reload any new page.

The thing is, in order to get that sort of thinking working with Payments Standard you have to build the forms with all the fields on the page, which people can then see if they view source, and you could be susceptible to people hacking your stuff to try and submit orders at cheaper prices. There are ways to resolve this within an IPN solution, but if you're familiar with PHP or some other language, and you'll be using it anyway, then I would really recommend moving to the Express Checkout API's.

Express Checkout gives you a lot more freedom and flexibility to build your applications however you need without worrying about prying eyes. There are other advantages, too, like users will always end up on your site as opposed to Payments Standard. Even with Auto-Return enabled, users might not make it back to your thank you page when using Standard, so that may or may not be a big deal for you (although, it generally becomes an issue at some point as your website grows.)

Sorry for the long answer, but hopefully that helps.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for the detailed reply. Do you suggest using a HTML form to get the quantity then use JS to do quantity*price. Then the PayPal price would be the value of that outcome?
Yup, something like that should work just fine for you. Just a matter of dynamically updating the value of the PayPal form fields based on y our own form fields.
Just done some more research and it says: <input name="button_name" type="hidden" value="1234567890ABC" /> (obviously altered but you get the idea) and you can change the <value=""> part to a PHP variable e.g. <value="<?php echo $variable_here; ?>"> which should work. I think this is now sorted, thank you for your help.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.