java - How shall I post a variable number of user-defined data to Paypal? -
friends, have shopping cart code took on when started company, unfortunately i'm weak on java , integrating paypal. here form sends data paypal when customer checks out of shopping cart. can send 1 product, include data on products purchased cart. thinking logic:iterate me? how increment "on#" , "os#" when presented variable amount of products?
<form name="paypal" id="paypal" style="float:left;" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="lc" value="us"> <input type="hidden" name="business" value="shop@myshop.com"> <input type="hidden" name="item_name" value="order detail information"> <input type="hidden" name="amount" id="amount" value="${tdollartotal}"> <input type="hidden" name="currency_code" id="currency" value="usd"> <input type="hidden" name="on0" value="buymethod"> <input type="hidden" name="os0" id="buymethod" value="shopping cart"> <input type="hidden" name="on1" value="orderid"> <input type="hidden" name="os1" id="orderid" value=""> <input type="hidden" name="on2" value="address"> <input type="hidden" name="os2" value="kunming yunnan china"> <input type="hidden" name="on3" value="purchased at"> <input type="hidden" name="os3" value="www.danyunfairtrade.com"> <logic:present name="shopclass" property="cart"> <logic:iterate id="cartinfo" name="shopclass" property="cart" indexid="index"> <bean:define id="product" name="cartinfo" property="product"></bean:define> <input type="hidden" name="on4" value="productno"> <input type="hidden" name="os4" id="productno" value="${product.productno }"> <input type="hidden" name="on5" value="productname"> <input type="hidden" name="os5" id="productname" value="${product.name }"> </logic:iterate> </logic:present> <input type="hidden" name="notify_url" value="http://www.danyunfairtrade.com/cart.html"> <img name="paypal" src="/images/qujiesuan.gif" class="jiesuan" border=0 style="cursor: pointer;" onclick="javascript:gopaypal();" /> </form>
what you're looking 'cart upload' functionality. see below example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="seller@example.com"> <input type="hidden" name="item_name_1" value="first items"> <input type="hidden" name="amount_1" value="3.00"> <input type="hidden" name="item_name_2" value="second items"> <input type="hidden" name="amount_2" value="5.00"> <input type="submit" value="paypal"> </form>
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_id=developer/e_howto_html_cart_upload
Comments
Post a Comment