Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Paypal Silent Transaction in ASP.NET
WhatsApp
Kumar Bhimsen
Jan 04
2016
1.3
k
0
0
using
System;
using
System.Net;
using
System.Text;
using
System.IO;
public
partial
class
PayPal
{
public
void
DoDirect()
{
//API Credentials (3-token)
string
strUsername =
"Your userName"
;
string
strPassword =
"QFZCWN5HZM8VBG7Q"
;
string
strSignature =
"A21eW1ch..NEqJJ-glaLhqkBMlzeAsWqX0ycck-CTc0tKI4pa1u.rgNF"
;
string
strCredentials =
"USER="
+ strUsername +
"&PWD="
+ strPassword +
"&SIGNATURE="
+ strSignature;
string
strNVPSandboxServer =
"https://api-3t.sandbox.paypal.com/nvp"
;
string
strNVPLiveServer =
"https://api-3t.paypal.com/nvp"
;
string
strAPIVersion =
"2.3"
string
strNVP = strCredentials +
"&METHOD=DoDirectPayment&CREDITCARDTYPE=VISA&ACCT=XXXXXXXXXXXXXXXXX&EXPDATE=092007&CVV2=808&AMT=212.95&FIRSTNAME=Designer&LASTNAME=Fotos&IPADDRESS=255.55.167.002&STREET=1234+Easy+Street&CITY=San+Jose&STATE=CA&COUNTRY=United+States&ZIP=95110&COUNTRYCODE=US&PAYMENTACTION=Sale&VERSION="
+ strAPIVersion;
//Create web request and web response objects, make sure you using the correct server (sandbox/live)
HttpWebRequest wrWebRequest = (HttpWebRequest) WebRequest.Create(strNVPSandboxServer);
//Set WebRequest Properties
wrWebRequest.Method =
"POST"
;
// write the form values into the request message
StreamWriter requestWriter =
new
StreamWriter(wrWebRequest.GetRequestStream());
requestWriter.Write(strNVP);
requestWriter.Close();
// Get the response.
HttpWebResponse hwrWebResponse = (HttpWebResponse) wrWebRequest.GetResponse();
StreamReader responseReader =
new
StreamReader(wrWebRequest.GetResponse().GetResponseStream());
// and read the response
string
responseData = responseReader.ReadToEnd();
responseReader.Close();
string
result = Server.UrlDecode(responseData);
}
}
Paypal silent transaction
C#
ASP.NET
Up Next
Paypal Silent Transaction in ASP.NET