【发布时间】:2016-03-15 13:12:21
【问题描述】:
我必须在我的一个项目中使用 paypal 自适应帐户创建 Rest api。 Java 库在这里https://github.com/paypal/adaptiveaccounts-sdk-java。但是当我尝试使用以下代码集成它时
RequestEnvelope env = new RequestEnvelope();
env.setErrorLanguage("en_US");
NameType name = new NameType("John", "Lui");
AddressType address = new AddressType("Main St", "US");
String preferredLanguageCode ="en_US";
CreateAccountRequest createAccountRequest = new CreateAccountRequest(env,name, address, preferredLanguageCode);
Map<String, String> customConfigurationMap = new HashMap<String, String>();
customConfigurationMap.put("mode", "sandbox");
customConfigurationMap.put("acct1.UserName", "protest348_api1.gmail.com");
customConfigurationMap.put("acct1.Password", "HD6X2RX38WE78NUW");
customConfigurationMap.put("acct1.Signature", "AOKE31.o6thw-ButmC4-x.YFN6U-AuGNMBPR0Dbd9hkDMfzgJ1Zcm7yo");
customConfigurationMap.put("acct1.AppId", "APP-80W284485P519543T");
customConfigurationMap.put("sandbox.EmailAddress", "anoop.pk.kumar@gmail.com");
AdaptiveAccountsService adaptiveAccountsService = new AdaptiveAccountsService(customConfigurationMap);
CreateAccountResponse createAccountResponse = adaptiveAccountsService.createAccount(createAccountRequest,"development@zgmail.com");
log.info(createAccountResponse.getAccountId());
在日志中我收到了类似的错误
Unable to generate Access Token com.paypal.exception.MissingCredentialException: Account for the username does not exists in the properties file
我该如何解决这个问题。我在 github 上也有同样的事情。但我不知道我是否正确添加了用户名、密码和签名。如何用库文件中的默认签名覆盖我的签名?请帮助我。
【问题讨论】:
标签: paypal paypal-adaptive-payments