I have a rather complicated issue that I am trying to solve in PHP and Paypal's IPN codes..
I am selling one product wh开发者_开发技巧ich has multiple licenses in a drop down box, for example:
5 users - $20 10 users- $50 20 users - $100
Once someone purchases a license, I got the $payment_amount passed from paypal and did an if, ifelse statement to generate the number of usernames accordingly.
I did not think about different currencies, therefore this technique won't work. Instead, I need to be able to assign an ID to each option in the drop down box and pass that instead.
I was wondering if this is possible and how I might go about doing this.
You could easily use any of the variables in the list of HTML variables to accomplish what you wish.
- You could use invoice, and save the information to a database.
- You could use on0 and os0 to define your own variables and price values.
- You could define the 'custom' variable and set it to whatever your dreams desire.
All of them are equally effective, though the most commonly used method is probably #2.
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="tester@test.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="asdfsafd">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<table>
<tr><td><input type="hidden" name="on0" value="numUsers">numUsers</td></tr><tr><td><select name="os0">
<option value="5 users">5 users $5.00</option>
<option value="10 users">10 users $9.00</option>
<option value="20 users">20 users $17.00</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="option_select0" value="5 users">
<input type="hidden" name="option_amount0" value="5.00">
<input type="hidden" name="option_select1" value="10 users">
<input type="hidden" name="option_amount1" value="9.00">
<input type="hidden" name="option_select2" value="20 users">
<input type="hidden" name="option_amount2" value="17.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_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>
精彩评论