C#中windows窗体应用程序中的paypal沙盒测试帐户,用于POS信用卡刷卡 我创建了一个windows窗体应用程序示例 我在VisualStudio中下载PayPalSDK 我创建了贝宝沙盒测试帐户
为什么要添加凭证详细信息? 我们放置应用程序id的位置: 沙盒测试AppID: APP-80W284485P519543T 我复制了一些winform应用程序的代码,同时单击了一个按钮C#中windows窗体应用程序中的paypal沙盒测试帐户,用于POS信用卡刷卡 我创建了一个windows窗体应用程序示例 我在VisualStudio中下载PayPalSDK 我创建了贝宝沙盒测试帐户,c#,json,rest,paypal,C#,Json,Rest,Paypal,为什么要添加凭证详细信息? 我们放置应用程序id的位置: 沙盒测试AppID: APP-80W284485P519543T 我复制了一些winform应用程序的代码,同时单击了一个按钮 Dictionary<string, string> sdkConfig = new Dictionary<string, string>(); sdkConfig.Add("mode", "sandbox"); accessToken
Dictionary<string, string> sdkConfig = new Dictionary<string, string>();
sdkConfig.Add("mode", "sandbox");
accessToken = new OAuthTokenCredential("AQkquBDf1zctJOWGKWUEtKXm6qVhueUEMvXO_-MCI4DQQ4-LWvkDLIN2fGsd", "EL1tVxAjhT7cJimnz5-Nsx9k2reTKSVfErNQF-CmrwJgxRtylkGTKlU4RvrX", sdkConfig).GetAccessToken();
HttpContext CurrContext = HttpContext.Current;
APIContext apiContext = new APIContext(accessToken);
Item item = new Item();
item.name = _ItemDescription;
item.currency = "USD";
item.price = _Amount;
item.quantity = "1";
item.sku = _UPC;
List<Item> itms = new List<Item>();
itms.Add(item);
ItemList itemList = new ItemList();
itemList.items = itms;
Address billingAddress = new Address();
billingAddress.city = "Chennai";
billingAddress.country_code = "US";
billingAddress.line1 = "11/12";
billingAddress.line2 = "Andavar nager main street";
billingAddress.postal_code = "600089";
billingAddress.state = "Tamil nadu";
CreditCard crdtCard = new CreditCard();
crdtCard.billing_address = billingAddress;
crdtCard.cvv2 = 2222;
crdtCard.expire_month = 4;
crdtCard.expire_year = 2020;
crdtCard.first_name = "Arul";
crdtCard.last_name = "Murugan";
crdtCard.number = "4032039053301695";
crdtCard.type = "visa";
Details details = new Details();
details.tax = "0";
details.shipping = "0";
details.subtotal = _Amount;
Amount amont = new Amount();
amont.currency = "USD";
amont.total = _Amount;
amont.details = details;
Transaction tran = new Transaction();
tran.amount = amont;
tran.description = _ItemDescription;
tran.item_list = itemList;
List<Transaction> transactions = new List<Transaction>();
transactions.Add(tran);
FundingInstrument fundInstrument = new FundingInstrument();
fundInstrument.credit_card = crdtCard;
List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>();
fundingInstrumentList.Add(fundInstrument);
PayerInfo pi = new PayerInfo();
pi.email = "sysumurugan-facilitator@gmail.com";
pi.first_name = "Arul";
pi.last_name = "Murugan";
Payer payr = new Payer();
payr.funding_instruments = fundingInstrumentList;
payr.payment_method = "credit_card";
payr.payer_info = pi;
pi.shipping_address = new ShippingAddress
{
city = "San Mateo",
country_code = "US",
line1 = "SO TEST",
line2 = "",
postal_code = "94002",
state = "CA",
};
Payment paymnt = new Payment();
paymnt.intent = "sale";
paymnt.payer = payr;
paymnt.transactions = transactions;
try
{
Payment createdPayment = paymnt.Create(apiContext);
CurrContext.Items.Add("ResponseJson", JObject.Parse(createdPayment.ConvertToJson()).ToString(Formatting.Indented));
}
catch (PayPal.Exception.PayPalException ex)
{
if (ex.InnerException is PayPal.Exception.ConnectionException)
{
CurrContext.Response.Write(((PayPal.Exception.ConnectionException)ex.InnerException).Response);
}
else
{
CurrContext.Response.Write(ex.Message);
}
}
catch (Exception es)
{
MessageBox.Show( es.ToString());
}
CurrContext.Items.Add("RequestJson", JObject.Parse(paymnt.ConvertToJson()).ToString(Formatting.Indented));
请向我解释通过win form应用程序进行POS(销售点)信用卡交易的任何其他方式。PayPal.NET SDK适用于服务器应用程序(例如ASP.NET),其中应用程序凭据以安全的方式存储。直接从POS系统上运行的WinForms应用程序使用SDK存在安全风险,因为您的商户帐户凭据未以安全方式存储。理想情况下,POS系统应该与执行处理的某个安全服务器通信 话虽如此,这个用例正是设计的目的
http://pastebin.com/H7VuPQs4