asp.net – PayPal REST API DotNet SDK 1.9.1 – URI端点在哪里?
|
我将PayPal Dotnet REST SDK 1.9.1安装到测试应用程序中,一切正常(完全没有问题).但是注意到端点没有指定(我也不需要指定它),所以我认为它存储在某个地方(paypal.dll?). 运行SDK代码示例(取自PayPal的开发人员站点)似乎会自动生成3个链接. 我是否需要担心URI是否嵌入在某个地方的dll中? 有没有理由改变它? *****编辑******* public static PayPal.Api.APIContext GetPaypalRestAPIContext()
{
try
{
Dictionary<string,string> config = null;
if (WebAppSettings.PaypalMode.ToLower != "live")
{
config = new Dictionary<string,string>()
{
{"mode",WebAppSettings.PaypalMode.ToLower},{"clientId",WebAppSettings.PaypalTestClientId},{"clientSecret",WebAppSettings.PaypalTestClientSecret},{"endpoint","https://api.sandbox.paypal.com/"}
};
}
else
{
config = new Dictionary<string,WebAppSettings.PaypalClientId},WebAppSettings.PaypalClientSecret},"https://api.paypal.com/"}
};
}
string accessToken = (new PayPal.Api.OAuthTokenCredential(config)).GetAccessToken();
PayPal.Api.APIContext apiContext = new PayPal.Api.APIContext(accessToken);
return apiContext;
}
catch (Exception ex)
{
EventLog.LogEvent("Paypal APIContext","PaypalRestAPIContext has failed.",EventLogSeverity.Warning);
return null;
}
}
我觉得我在这里错过了一些东西或者失去了理智. 解决方法根据 API reference documentation
这些相同的URL可以在BaseConstants类的GitHub Repository of the SDK中找到,这意味着它们实际上是在SDK中嵌入/硬编码的 /// <summary> /// Sandbox REST API endpoint /// </summary> public const string RESTSandboxEndpoint = "https://api.sandbox.paypal.com/"; /// <summary> /// Live REST API endpoint /// </summary> public const string RESTLiveEndpoint = "https://api.paypal.com/"; /// <summary> /// Security Test Sandbox REST API endpoint /// </summary> public const string RESTSecurityTestSandoxEndpoint = "https://test-api.sandbox.paypal.com/"; 这将确认观察到由SDK“生成”的3个链接. 文档中也提到了.
PayPal Config Settings
<configuration>
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler,PayPal" />
</configSections>
<!-- PayPal SDK settings -->
<paypal>
<settings>
<add name="mode" value="sandbox"/>
<add name="clientId" value="_client_Id_"/>
<add name="clientSecret" value="_client_secret_"/>
</settings>
</paypal>
</configuration>
因此,看起来设置中的模式将确定在向API发出请求时SDK调用哪个端点URL. 回答你的问题.
没有.
它们允许工具在设置中更改代码运行的模式,以便在执行时使用适当的enpoint URL.这意味着如果要对沙箱运行测试,则只需更改应用程序的模式设置即可. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – 用于货币格式的ASP.NET MVC数据注释
- asp.net c#membership:如何做一个GetUsersInRoles(多个角色
- asp.net-mvc – ELMAH和SQL Server 2008 R2?
- asp.net-mvc – ASP.NET MVC获取上次添加记录的ID
- asp.net-mvc-3 – 什么是MVC 3中的ModelState类?
- asp.net-mvc – ASP.Net MVC – 处理不好的URL参数
- 我们可以在ASP.NET Webforms(* .aspx页面)中使用Razor语法吗
- asp.net – 在Web.config中是否可以在指定目录中注册所有用
- asp.net-mvc-4 – 如何在asp.net mvc应用程序中使用Gmail S
- 你如何正确使用UpdatePanel? (asp.net)
- asp-classic – 如何在经典ASP中遍历集合?
- asp.net-mvc – ASP.NET MVC中的Crystal Reports
- ASP.NET MVC中的runat =“server”标签的状态是什
- asp.net – 从类型’DBNull’到类型’String’的
- asp.net – SCRIPT5022:Sys.WebForms.PageReque
- “经典”ASP.NET页面和Microsoft MVC可以在同一个
- asp.net-mvc – 获取ASP.Net MVC中任何文件的完整
- asp.net – 哪里是.ASPXAUTH cookie
- asp.net-membership – 成员资格超时和会话超时
- 如何指导获取一个经典的asp应用程序在IIS 7.0下工
