I am using the Paypal NVP API, as well as the BMCreateButton API, to create encrypted buttons with Java code.
I have the simplest button shape. So, for example, for a T-Shirt, which costs 8.00, the code for creating the button (remember, this is a fragment of only part of the variables) -
//... NVPEncoder encoder = new NVPEncoder(); encoder.add("METHOD", "BMCreateButton"); encoder.add("BUTTONCODE","ENCRYPTED"); encoder.add("BUTTONTYPE","CART"); encoder.add("L_BUTTONVAR1","amount=8.00"); encoder.add("L_BUTTONVAR2","item_number=6985855"); encoder.add("L_BUTTONVAR3","item_name=T-Shirt"); //...
It's simple enough, but realistic, the products have other options. A t-shirt can have color and size options that will be displayed in the html <select> menu on the page. In addition, each color / size setting will have a different price.
I'm stuck here. Between the HTML Variable link and the BMCreateButton API on the Paypal page, I'm confused!
The Html code that should be displayed with the options on the selection menu will be:
<input type="hidden" name="on0" value="Color & Size">Color & Size <input type="hidden" name="option_select0" value="Pink Small" /> <input type="hidden" name="option_amount0" value="6.00" /> <input type="hidden" name="option_select1" value="Pink Medium" /> <input type="hidden" name="option_amount1" value="7.00" /> <input type="hidden" name="option_select2" value="Pink Large" /> <input type="hidden" name="option_amount2" value="8.00" /> <select name="os0"> <option value="Pink Small">Pink - Small $6.00 - (13)</option> <option value="Pink Medium">Pink - Medium $7.00</option> <option value="Pink Large">Pink - Large $8.00</option> </select>
How to do it?
The best I could think of, but of course it didn't work - it was -
//... NVPEncoder encoder = new NVPEncoder(); encoder.add("METHOD", "BMCreateButton"); encoder.add("BUTTONCODE","ENCRYPTED"); encoder.add("BUTTONTYPE","CART"); encoder.add("L_BUTTONVAR1","item_number=6985855"); encoder.add("L_BUTTONVAR2","item_name=Dress"); encoder.add("L_BUTTONVAR3","on0=Color & Size"); encoder.add("L_BUTTONVAR4","option_select0=Pink Small"); encoder.add("L_BUTTONVAR5","option_amount0=6.00"); encoder.add("L_BUTTONVAR6","option_select1=Pink Medium"); encoder.add("L_BUTTONVAR7","option_amount1=7.00"); encoder.add("L_BUTTONVAR8","option_select2=Pink Large"); encoder.add("L_BUTTONVAR9","option_select2=8.00"); encoder.add("OPTION0NAME","Color & Size"); encoder.add("L_OPTION0SELECT0","Pink Small"); encoder.add("L_OPTION0PRICE0","6.00"); encoder.add("L_OPTION0SELECT1","Pink Medium"); encoder.add("L_OPTION0PRICE1","7.00"); encoder.add("L_OPTION0SELECT2","Pink Large"); encoder.add("L_OPTION0PRICE2","8.00"); //...
Can anyone help me out? Thanks:)