Volume discounts with PayPal Merchant Services

You’re probably not going to like this solution very much.

To set the scene, PayPal’s “Merchant Services” contains a fairly straightforward webapp to generate “Buy Now” and other such buttons. When we needed to sell a product at work, I figured that the steps would be as simple as:

  1. Generate the button
  2. Slap it on our website

Unfortunately for me, we were offering a volume discount (AKA, bulk rate) so that the price of the item was different depending on the quantity. After much mucking around in help pages and documentation, I found the “solution” in the PayPal Developer Community forums: Volume Discount with Shopping Carts

Long story short:

  1. Don’t use PayPal’s button generator
  2. Download the zipped HTML file referenced in the forum
  3. Read the HTML file and its source, giving you the knowledge to:
    1. Add some generically-written javascript functions to your site
    2. Create a custom HTML button (i.e., not generated by PayPal)
    3. Add the HTML inputs and inline javascript needed to drive the functions
  4. Tell your bookkeeper to double-check the payment amounts because any tech-savvy person could submit a form with whatever prices they please

The problem is that when using your own custom buttons, PayPal cannot do any validations on their end. You send them item names and amounts, and they’ll happily charge the customer for whatever happens to come across the wire. From my limited research, I think you can do this more cleanly if you implement your own shopping cart, and interface with PayPal in a more secure way.

But for the “simple” stuff, the best way to get started would be by perusing the PayPal Developer Central’s Simple Integration section. I found the HTML Variables for Website Payments Standard to be particularly useful. It really wouldn’t be that hard for PayPal to implement volume discount functionality on their end, but I suspect that maybe it’s something they are trying to sell in a “Pro” version.

This entry was posted in HOW-TOs, Programming. Bookmark the permalink.

2 Responses to Volume discounts with PayPal Merchant Services

  1. Ryan says:

    That is a really robust solution. A few alternative ideas:
    # Could you insert a little bit of server-side processing that determines the price and then redirects to paypal?
    # Maybe an ajax call when the button is clicked to validate the price before allowing the button click event to process?
    # generate paypal buttons for each different volume price, and use JS to show/hide the right button?
    # generate paypal buttons for each different volume price, and decide server-side which one you want? Then changing the quantity needs to post back to the server, which is annoying.

    Those are all still vulnerable, but might make it harder to cheat you.

  2. theoden says:

    This is a good list of alternatives, though like you said, you can’t really eliminate the client’s ability to purchase items at a different volume discount than the correct one. In the end, the buyer still has to commit money via PayPal without having received any goods; probably a much greater risk to them than to us.

Leave a Reply

Your email address will not be published. Required fields are marked *