Reputation: 5132
I'd like to integrate paypal using Website Payments Standard. I have 2 needs.
First, a user can pick from options 3 dropdowns on my site that impacts the price. The price changes depending on the option selected by looking up the correct value from the server on the back-end. When a user selects the "Buy Now" button, it should pick up the right price and the right options selected in the form (the one's displayed that the user has chosen).
Second, the price the user pays once the transaction has been completed and verified should be deducted from an "Inventory" amount on my back-end (from the server).
How do I get these 2 capabilities using Paypal? Is this something where I should use Payment Data Trasfer (at least for the 2nd question)?
Upvotes: 1
Views: 840
Reputation: 2923
You're right, dynamic pricing and inventory management are bundled together.
Regarding dynamic pricing you can do this with the regular PayPal "Buy Now" button. Go to your PayPal account and create a new "Buy Now" button. You'll need to disable the "Save button at PayPal" checkbox, then when you generate your code you can "unprotect" the button to expose the individual fields, including the item price. You can then update the price based on a server or browser calculation.
Because pricing and inventory are bundled, un-clicking the "Save button at PayPal" disables inventory functions as well.
Finally, beware that un-protecting the "Buy Now" code allows a "bad guy" to change the price of your product browser side (the same way you are), so you'll need to perform additional verification on your orders.
Here's a sample of the un-protected "Buy Now" button code. Use the "amount" field to update
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="Your Business Code here...">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value="Widgets">
<input type="hidden" name="item_number" value="12345">
<input type="hidden" name="amount" value="20.00">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Upvotes: 2