paypal自适应帐户创建

时间:2016-03-15 13:12:22

标签: paypal paypal-adaptive-payments

我必须在我的一个项目中使用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

如何解决此问题。我在githhub中跟随同样的事情。但我不知道我是否正确添加了用户名,密码和签名。如何使用库文件中的默认签名覆盖我的签名?请帮帮我。

1 个答案:

答案 0 :(得分:1)

您必须为沙盒环境创建(虚假)用户。您可以在https://developer.paypal.com/

完成所有操作
  • 请转到PayPal developer并登录。
  • 然后点击“仪表板”
  • 在“沙盒”下点击“帐户”(或点击 here)。
  • 在该页面中,您可以创建用户。为买家和一些人创造一些 对于卖家。在那里,您也可以获得这些用户的凭据。
相关问题