Unable to test my C# code for make payment with credit card from my website
paullejoy
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jan-11-2019
02:44 AM
unable to make payment with my c# code unable to make connect with paypal sdk when i m try to test my code its show me error (Transaction Error: Error: This transaction cannot be processed. The merchant's account is not able to process transactions.) 10548 this is my code plz check
string hostname = Dns.GetHostName(); string ip = Dns.GetHostByName(hostname).AddressList[0].ToString(); //API Credentials (3-token) ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; string strUsername = "paullejoy9_api1.gmail.com"; string strPassword = "L7D2LYC3UTJCCUKD"; string strSignature = "A9LC3Qajo-H2V8mPq4eIktgPvG2RAu7RtQ5xuZR7cmasgxV8VCgG76AN"; string strCredentials = "USER=" + strUsername + "&PWD=" + strPassword + "&SIGNATURE=" + strSignature; string strNVPSandboxServer = "https://api-3t.sandbox.paypal.com/nvp"; string strAPIVersion = "2.3"; string strNVP = strCredentials + "&METHOD=DoDirectPayment" + "&CREDITCARDTYPE=" + ddlcardtype.Value + "&ACCT=" + txtcardno.Value + "&EXPDATE=" + ddlexpmonth.Value + ddlexpyear.Value + "&CVV2=" + txtcvv.Value + "&AMT=1" + "&FIRSTNAME=" + txtfname.Value + "&LASTNAME=" + txtlastName.Value + "&IPADDRESS=" + ip + "&STREET=" + txtstreet.Value + "&CITY=" + txtcity.Value + "&STATE=" + txtstate.Value + "&COUNTRY=" + ddlcountry.Value + "&ZIP=" + txtzipcode.Value + "&COUNTRYCODE=US" + "&PAYMENTACTION=Sale" + "&VERSION=" + strAPIVersion; try { //Create web request and web response objects, make sure you using the correct server (sandbox/live) HttpWebRequest wrWebRequest = (HttpWebRequest)WebRequest.Create(strNVPSandboxServer); wrWebRequest.Method = "POST"; 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); string[] arrResult = result.Split('&'); Hashtable htResponse = new Hashtable(); string[] responseItemArray; foreach (string responseItem in arrResult) { responseItemArray = responseItem.Split('='); htResponse.Add(responseItemArray[0], responseItemArray[1]); } string strAck = htResponse["ACK"].ToString(); if (strAck == "Success" || strAck == "SuccessWithWarning") { resultDiv.Visible = true; string strAmt = htResponse["AMT"].ToString(); string strCcy = htResponse["CURRENCYCODE"].ToString(); string strTransactionID = htResponse["TRANSACTIONID"].ToString(); // ordersDataSource.InsertParameters["TransactionID"].DefaultValue = strTransactionID; string strSuccess = "Thank you, your order for: $" + strAmt + " " + strCcy + " has been processed."; lblstatus.Text = strSuccess; } else { resultDiv.Visible = true; string strErr = "Error: " + htResponse["L_LONGMESSAGE0"].ToString(); string strErrcode = "Error code: " + htResponse["L_ERRORCODE0"].ToString(); lbltransactionerror.Text = strErr; lblstatus.Text = strErrcode; return; }
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Sandbox testing has beaten me !! in Sandbox Environment
- Customising Paypal Checkout Button in PayPal Payments Standard
- Button in PayPal Payments Standard
- Need help to integrate Advanced Checkout (PPCP) With WHMCS in PayPal Upgrade Community
- link my PayPal business account with my WordPress website , but it's not work ?! in PayPal Payments Standard