當前位置:首頁 » 密碼管理 » paypal加密

paypal加密

發布時間: 2024-01-30 12:11:13

『壹』 Paypal在線支付加密如何配置

這個是官方的示例,C#的. https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_AspNet_WPS_Toolkit.zip
下面是演示如何使用信用卡付帳的.1- 創建一個頁面,上面有如下的控制項:
cctypeDdl, ccnumberTextbox, expdateDropDown, yearDropDown, CVVcodeTextBox, amountTextBox, firstnameTextbox, lastnameTextbox, addressTextbox, cityTextbox, regionTextbox, countryDropDown, postalTextbox
標簽: successLabel, errLabel, errcodeLabel

2- 創建一個按鈕,雙擊生成 button_click 的event handler

3- 把下面代碼復制到按鈕的 event handler

//API Credentials (3-token)
string strUsername = "brad_apiX.w3XXXXX.com";
string strPassword = "XXXCCGUJP2EXXXX";
string strSignature = "";
string strCredentials = "USER=" + strUsername + "&PWD=" + strPassword + "&SIGNATURE=" + strSignature;

//paypal的支付地址
string strNVPSandboxServer = " https://api-3t.sandbox.paypal.com/nvp";
string strAPIVersion = "2.3";

string strNVP = strCredentials + "&METHOD=DoDirectPayment" +
"&CREDITCARDTYPE=" + cctypeDdl.Text +
"&ACCT=" + ccnumberTextbox.Text +
"&EXPDATE=" + expdateDropDown.Text + yearDropDown.Text +
"&CVV2=" + CVVcodeTextBox.Text +
"&AMT=" + amountTextBox.Text +
"&FIRSTNAME=" + firstnameTextbox.Text +
"&LASTNAME=" + lastnameTextbox.Text +
"&IPADDRESS=255.55.167.002" +
"&STREET=" + addressTextbox.Text +
"&CITY=" + cityTextbox.Text +
"&STATE=" + regionTextbox.Text +
"&COUNTRY=" + countryDropDown.Text +
"&ZIP=xxxx" + postalTextbox.Text +
"&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")
{
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.";
successLabel.Text = strSuccess;
}
else
{
string strErr = "Error: " + htResponse["L_LONGMESSAGE0"].ToString();
string strErrcode = "Error code: " + htResponse["L_ERRORCODE0"].ToString();
errLabel.Text = strErr;
errcodeLabel.Text = strErrcode;
return;
}
}
catch (Exception ex)
{
// do something to catch the error, like write to a log file.
Response.Write("error processing");
}//建議使用SSL加密,否則信息會被竊取.

熱點內容
方舟編譯器廠家 發布:2024-11-28 04:13:15 瀏覽:979
android源碼編輯 發布:2024-11-28 04:12:38 瀏覽:596
兩路伺服器是什麼意思 發布:2024-11-28 03:39:39 瀏覽:937
sql精簡版64 發布:2024-11-28 03:36:28 瀏覽:73
金立怎麼加密圖片 發布:2024-11-28 03:31:43 瀏覽:664
2017玩dnf電腦什麼配置 發布:2024-11-28 03:30:56 瀏覽:520
ftp掛載存儲ip配置 發布:2024-11-28 03:28:51 瀏覽:963
山耐斯空壓機密碼多少 發布:2024-11-28 03:26:28 瀏覽:405
安卓拍照搖一搖是什麼軟體 發布:2024-11-28 03:26:27 瀏覽:257
小米2s存儲卡 發布:2024-11-28 03:15:49 瀏覽:649