PayPal integration using a HTTP GET request

2. February 2010

Author Aamir Hasan

Yesterday some one call me and ask me about how to integration with Pay pay using asp.net csharp HTTP GET request.She was facing a problem so i decided why should not i make an article.

Step you have to follow

  1. Sign up for a PayPal account. They have personal, premier, and business accounts. You will need to upgrade to a premier or business account to accept credit cards.
  2. Download the source code above
  3. Put in your PayPal email address in the SendPayPal.aspx page
  4. Tailor the Master Page to have the look desired
  5. Add your products to the xml file
  6. Add your pictures to the pictures folder

Simple Example's

Example 1

Simple to copy in your aspx Page

<form method="post" action= "https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="my@email.com">
<input type="hidden" name="item_name" value="Item name">
<input type="hidden" name="item_number" value="1234">
<input type="hidden" name="amount" value="19.95">
<input type="hidden" name="no_shipping" value="1">
<input type="submit" value="Buy Now">
</form>

// Variables
string business = "your_email@example.com";
string item_name = "driver set";
string item_number = "10";
decimal amount = 110.99;


// Build the PayPal url StringBuilder sb = new StringBuilder(); sb.Append("cmd=_xclick"); sb.Append("&business=" + HttpUtility.UrlEncode(business)); sb.Append("&no_shipping=1"); sb.Append("&currency_code=GBP"); sb.Append("&lc=GB"); sb.Append("&bn=PP-BuyNowBF"); sb.Append("&item_name=" + HttpUtility.UrlEncode(item_name)); sb.Append("&item_number=" + HttpUtility.UrlEncode(item_number)); sb.Append("&amount=" + HttpUtility.UrlEncode(amount.ToString()));

// Redirect to PayPal to make secure payment Response.Redirect(@"https://www.paypal.com/cgi-bin/webscr?" + sb.ToString());



* URL is the URL to work with, depending on whether the sandbox or a real PayPal account should be used
* cmd is a command that is sent to PayPal * business is the seller's e-mail
* item_name is the item name (what the buyer pays for) that will be shown to the user
* amount is the payment amount
* no_shipping is a parameter that determines whether the delivery address should be requested
* return_url is the URL the buyer will be redirected to when payment is successfully performed
* rm is a parameter that determines the way information about a successfully finished transaction will be sent to the script specified in the return parameter
* notify_url is the URL PayPal will send information about the transaction (IPN) to
* cancel_url is the URL the buyer is redirected to when he cancels payment
* currency_code is the currency code
* request_id is an identifier of payment request

Download Sample Kit

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks

 

 


Author: Aamir Hasan     औथोर: आमिर हसन       أثر أمير حسن .

ALL, asp.net ,


Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading





User Name: Guest

Your Ip: 38.107.191.90
Time: