How to Integrate Paypal with Asp.Net
In this article I will explain thoroughly all the requirements and techniques for integrating PayPal in your web application.
Nowadays PayPal is the most popular payment gateway worldwide because it is totally free to integrate and PayPal does not charge anything for opening an account, you will pay PayPal when you get paid. And the amount is also lower than other payment gateways. 
First of all you need to Create a paypal account. After creating an account, you need to open Paypal Developer and need to create 2 sandbox test account. One is for merchant and another is for buyer (1 merchant account will be provided to you by default).
Website Payment Standard (HTML)
In this section, I'll provide you a basic examples that will show how to create your own HTML form for receiving money over PayPal. You'll see how to use different variables in order to influence payment details. Before we delve into details, let's take a look at the two most basic variables:
- form's actionattribute - in most cases, it should be https://www.paypal.com/cgi-bin/webscr. If you are using Sandbox for testing payments, you'll change it to https://www.sandbox.paypal.com/cgi-bin/webscr - effectively, you just insert the word sandbox into the URL (this is also true for some other integrations; e.g., the PayPal API). For upcoming examples, I won't be using the Sandbox URL because most of you would just get that "Login to use the PayPal Sandbox features" screen (look up for the image).
- form's business child - I'll use youremailaddress@yourdomain.com for most examples; if you copy-paste the code, you'll want to replace that with the email of your PayPal account.
Basic Payment
<form
action="https://www.paypal.com/cgi-bin/webscr"
method="post">
    <input type="hidden" name="cmd"
value="_xclick" />
    <input type="hidden" name="business"
value="youremailaddress@yourdomain.com" />
    <input type="hidden" name="item_name"
value="My painting" />
    <input type="hidden" name="amount"
value="10.00" />
    <input type="submit" value="Buy!" />
</form>
HTML Variables &
Resources
Post
Payment Processing
Providing the
AutoReturl URL in your PayPal profile
Payment Data Transfer (PDT)
Now that you have the
Identity Token, you can query PayPal for more details after your return URL has
been hit. Here is how things flow when utilizing PDT:
protected void
Page_Load(object sender, EventArgs e)
     
  //read in txn token from querystring
     
  query =
string.Format("cmd=_notify-synch&tx={0}&at={1}", 
     
  // Create the request back
     
  // Set values for the request back
     
  // Write the request back IPN strings
}
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="youremailaddress@yourdomain.com" />
<input type="hidden" name="item_name" value="My painting" />
<input type="hidden" name="amount" value="10.00" />
<input type="submit" value="Buy!" />
</form>
}
By, Akash Roy, CEO, JPR Infoserve, http://jprinfoserve.com
 
No comments:
Post a Comment