Tuesday 15 September 2015

vb.net - Testing PayPal buttons -



vb.net - Testing PayPal buttons -

i generated vb.net website sell quantity of book. it's vb.net site using sql server backend. modeled book's order form on paper form company using. form allows customers specify: name, organization, address, city/state/zip, , quantity.

once form complete, submit form page records form values in database. have them press add together cart button supposed upload cart info paypal checkout. reason cart opens empty without errors.

here add together cart info:

<form action="https://www.sandbox.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="xxxxxx@xxx.xxx" /> <input type="hidden" name="item_number_1" value="2015" /> <input type="hidden" name="item_name_1" value="2015 catholic directory" /> <input type="hidden" name="amount_1" value="15.00" /> <input type="hidden" name="quantity_1" value="<%= request.form("add")%>" /> <input type="hidden" name="currency_code" value="usd" /> <input type="hidden" name="notify_url" value="http://10.5.0.43/catholicdirectory complete_order.aspx" /> <input type="hidden" name="no_shipping" value="2" /> <input type="image" src="https://www.paypalobjects.com/en_us/i/btn/btn_cart_lg.gif" border="0" name="submit" alt="paypal - safer, easier way pay online!" style="width:120px; height:26px;" target="_self"/></center> <img alt="" border="0" src="https://www.paypalobjects.com/en_us/i/scr/pixel.gif" width="1" height="1"> </form>

what need know how i:

why cart opening empty?

get paypal redirect website can mark transaction paid storing maybe paypal transaction id in database researched , able direct them if click link return, don't want them have click anything. research directed me seller settings in business relationship can't find them set auto homecoming url.

you're going want utilize paypal's ipn listener. there ipn simulator can utilize create sure it's hitting site correctly.

https://developer.paypal.com/webapps/developer/applications/ipn_simulator

https://developer.paypal.com/docs/classic/ipn/integration-guide/ipnsetup/

you'll need setup 2 accounts within sandbox. personal , business. business business relationship send transations. can utilize personal business relationship login , test payments.

as redirecting after payment, can set in both homecoming url , within paypal

<input type="hidden" name="return" value="https://yoursite.com/payment-success">

you can set auto homecoming next directions here: http://wemakewebsites.com/blog/how-to-get-paypal-to-auto-return-to-your-website-after-a-customer-payment

edit:

<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" > <input id="element_1" name="amount" type="text" /> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="yourbusiness@email.com"> <input type="hidden" name="currency_code" value="usd"> <input type="hidden" name="item_name" value="payment"> <input type="hidden" name="return" value="http://yourwebsite.com/payment-success"> <input type="hidden" name="rm" value="1"> <input type="image" src="http://yourwebsite.com/images/btn-donate.png" border="0" name="submit" alt="paypal - safer, easier way pay online!"> <input type="hidden" name="notify_url" value="http://yourwebsite.com/includes/paypal_ipn.aspx" /> </form>

once payment made user head on paypal finish payment. long have notify_url set working listener paypal nail it. in file want set few more db collections. paypal can send bunch of info (https://developer.paypal.com/docs/classic/ipn/integration-guide/ipnandpdtvariables/) depending on info looking for. in next illustration (https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.vb) you'd want add together db collection after line 35 user has completed payment:

if strresponse = "verified"

vb.net paypal

No comments:

Post a Comment