贝宝的C#REST API请求一个未公开的配置部分 [英] Paypal c# REST API asks for an undocumented configuration section
问题描述
我在战役哈克伦敦黑客努力,我在一个恼人的问题绊倒了。贝宝SDK的C#似乎并没有工作完全正确。
我试图做我的第一笔交易,这里是我的代码(我放在一起固定破碎在线文档:
VAR tokenCredential =新OAuthTokenCredential(什么东西,someother);
变种的accessToken = tokenCredential.GetAccessToken();
支付createdPayment =新的支付
$ { b $ b意图=买卖,
交易=新的List<交易>
{
新的交易
{
金额=新的金额
{
共计= value.ToString(R),
货币=GBP
},
说明= forWhat
}
}
} .Create(的accessToken);
这将导致
无法解析* .config文件。确保你已经正确配置了贝宝部分。
块引用>
我已经追踪到的这行代码的,但我不知道如何正确地配置部分,我找不到正确的文档。
如何里边反CSHARP REST SDK应该是配置?
解决方案我的支持贝宝开发的工作了这一点。一个人需要补充:
<预类=郎咸平的XML prettyprint-覆盖>< configSections>
<节名称=贝宝TYPE =PayPal.Manager.SDKConfigHandler,PayPalCoreSDK/>
< / configSections>
<&贝宝GT;
<应收>
<帐户apiUsername =XXX
apiPassword =YYY
的applicationID =APP-80W284485P519543T
apiSignature =ZZZ
/>
< /账户>
<设置>
<添加名称=模式值=沙箱/>
< /设置>
< /贝宝>
其中,
XXX
,YYY
,ZZZ
你是,你从你的主要的沙盒测试帐户。I'm hacking hard at Battle Hack London and I've stumbled in an annoying problem. The PayPal SDK for c# doesn't seem to work quite right.
I'm trying to do my first transaction and here's my code (which I put together fixing the broken online docs:
var tokenCredential = new OAuthTokenCredential(something, someother); var accessToken = tokenCredential.GetAccessToken(); Payment createdPayment = new Payment { intent = "sale", transactions = new List<Transaction> { new Transaction { amount = new Amount { total = value.ToString("R"), currency = "GBP" }, description = forWhat } } }.Create(accessToken);
This results in
Cannot parse *.Config file. Ensure you have configured the 'paypal' section correctly.
which I've traced down to this line of code but I don't know how to configure that section correctly and I can't find the correct documentation.
How is tthe csharp REST SDK supposed to be configured?
解决方案I've worked this out with the support of a PayPal dev. One needs to add:
<configSections> <section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK"/> </configSections> <paypal> <accounts> <account apiUsername="xxx" apiPassword="yyy" applicationId="APP-80W284485P519543T" apiSignature="zzz" /> </accounts> <settings> <add name="mode" value="sandbox"/> </settings> </paypal>
where
xxx
,yyy
,zzz
you are values that you get from the "Account details" of your main sandbox test account.这篇关于贝宝的C#REST API请求一个未公开的配置部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!