【发布时间】:2023-03-22 16:40:02
【问题描述】:
我已经使用 PayPal API 在我的网站中添加了 PayPal Express Checkout 和 PayPal Recurring Payments。
我在 web.config 文件中添加了 PayPal API 详细信息,如下所示
<appSettings>
<add key="APIUsername" value="username_api1.sitename.com"/>
<add key="APIPassword" value="1234567890"/>
<add key="APISignature" value="AYNTWwVp7kXPvCitJdl4O9aXZuCpAekoTM41ULLqI6Pt0lCy0tNDh8--"/>
<add key="Host" value="www.sandbox.paypal.com"/>
<add key="CurrencyCode" value="USD"/>
C# 代码
使用的命名空间 -
using com.paypal.sdk.services;
using com.paypal.sdk.profiles;
using com.paypal.sdk.util;
我正在使用名称值对方法
C# 代码
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
profile.APIUsername = System.Configuration.ConfigurationManager.AppSettings["APIUsername"];
profile.APIPassword = System.Configuration.ConfigurationManager.AppSettings["APIPassword"];
profile.APISignature = System.Configuration.ConfigurationManager.AppSettings["APISignature"];
caller.APIProfile = profile;
如您所见,我需要用户名、密码和签名才能接受付款。
我需要知道是否可以在不知道 API 密码字段的情况下接受付款。
我正在测试它,但如果有人已经知道这个问题的答案会很有用。
记住我只想接受付款。
谢谢。
【问题讨论】:
标签: c# asp.net paypal paypal-nvp