Thursday, October 11, 2012

paypal-parameters

 

srinivas.gavidi@gmail.com

Gavidi Srinivas  08886174458, 09393087430

How to pass the Single and Multiple values to paypal asp.net c#

For better testing create SANDBOX testing account in paypal. [www.paypal.com]

Here I m going explaining about Paypal a little bit that how we can send the multiple and single values to paypal. In paypal we can send the price in Dollar, Euro or which is accepted by paypal. Well, I m here explain the little format that how can we send the values to paypal from our website. We need just pass the parameters. You can refer the following link. In this link the paypal describe about the command and format of the values, which we have to pass to the paypal.
[https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside]

A string example:-

https:// www.paypal.com/us/cgi-bin/webscr? cmd=_ xclick&business=[yoouremailid]&item_name=[your item name value]&amount=[your amount]&quantity=[your quantity]&return=[your return address]?Paypal=true&cancel_return=[your cancel return address]?Paypal=false
The above string its only to send one value to paypal.

Note: don’t forget to put [&]

The format here is: -
  1. https://www.paypal.com/us/cgi-bin/webscr? [for redirect to paypal]
or for sandbox
https://www.sandbox.paypal.com/us/cgi-bin/webscr? [sanbox testing account]
  1. _cmd=xclick [for single value]
  2. &business=[your business e-mail id]
  3. &item_name=[name of the item]
  4. &amount=[total amount/single amount]
  5. &quantity=[total quantity/single quantity]
  6. &return=[return URL address after successful payment]
  7. &cancel_return=[return URL address after cancel the payment]
You can store the parameters in string and after concatenate send to paypal.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
String url;
url= “https://www.paypal.com/us/cgi-bin/webscr?” ;
url+= “cmd=_xclick”;
url+= “&business=vikvish@yahoo.co.in”;
url+= “&item_name=Sample_testing”;
url+= “&amount=10.50″;
url+= “&quantity=2″;
url+= “&return=http://www.google.com”;
url += “&cancel_return=http://www.rediffmail.com”;
url+= “&currency_code=USD”;
Response.Redirect(url);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Following the example:-
You can just put the following string in paypal URL and see the result what you will get.
And scroll down the page and click on[Cancel and return to] it will take you on the cancel_return specified URL which is rediff.com
The string for Single value in URL is following and you can just copy and the paste the following string in URL and see the result.
https://www.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=vikvish@yahoo.co.in&item_name=Sample_testing&amount=10.50&quantity=2&return=http://www.google.com&cancel_return=http://www.rediffmail.com&currency_code=USD
For multiple values like we to do in shopping cart we have to change the cmd parameter of the paypal URL and add the extra parameters. Here the following string.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
String url;
url= “https://www.paypal.com/us/cgi-bin/webscr?” ;
url+= “cmd=_cart”;
url+= “&upload=1″;
url+= “&business=vikvish@yahoo.co.in”;
url+= “&item_name_1=Sample_testing1″;
url+= “&amount_1=10.50″;
url+= “&quantity_1=1″;

url+= “&item_name_2=Sample_testing2″;
url+= “&amount_2=9.50″;
url+= “&quantity_2=2″;

url+= “&item_name_3=Sample_testing3″;
url+= “&amount_3=8.50″;
url+= “&quantity_3=3″;
url+= “&return=http://www.google.com”;
url += “&cancel_return=http://www.rediffmail.com”;
url+= “&currency_code=USD”;
Response.Redirect(url);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The string for Multiple values in URL is following and you can just copy and the paste the following string in URL and see the result.
Hope it will help you…

No comments:

Post a Comment