douzhang5984
2018-11-20 11:03
浏览 123
已采纳

PayPal java postback API始终是INVALID

The following question refers only to the "live" configuration, and not to the "sandbox" configuration:

I'm re-writing a php post back endpoint in java. The existing PHP was using this example, without any credentials, and with this url: https://ipnpb.paypal.com/cgi-bin/webscr

This above endpoint seems to return a "VERIFIED" response every time.

On the other hand, the Java Core SDK has this method for making a post back

IPNMessage::validate()

With url https://www.paypal.com/cgi-bin/webscr, and (maybe) with credentials (username, password, token and AppId).

The above API always returns false, due to an "INVALID" response.

My questions are:

  1. Is that the correct way to make a "post back" verification in Java?
  2. Do I need credentials to make this post back verification?

图片转代码服务由CSDN问答提供 功能建议

以下问题仅涉及“实时”配置,而不涉及“沙盒”配置:

我正在用java重新编写一个php post post端点。 现有的PHP使用这个示例,没有任何凭据,并且使用此URL: https://ipnpb.paypal.com/cgi-bin/webscr

上述端点似乎返回”已验证“ 每次回复。

另一方面, Java Core SDK 有这种回发方法

  IPNMessage:  :validate()
   
 
 

使用url https://www.paypal.com/cgi-bin/webscr ,以及(可能)凭据(用户名,密码,令牌和AppId)。

由于“INVALID”响应,上述API总是返回false。

我的问题是:

  1. 这是 在Java中进行“回发”验证的正确方法?
  2. 我是否需要凭据才能使此帖子重新验证?
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • drmet46444 2018-11-21 11:53
    已采纳

    It appears that it's ok to use Java's endpoint (https://www.paypal.com/cgi-bin/webscr).

    No credentials were required.

    The reason I got the "INVALID" IPN, was incorrect encoding of the Post Back request. In order to fix the encoding in PayPal (which sends the IPN), you should go to you PayPal account, and select "Profile and Settings" > "My selling tools" > "PayPal button language encoding" at the bottom of the screen > "More Options" then select the Java Core SDK's encoding ("windows-1252").

    Alternatively, you can fix the postback's encoding, by adding a "charset" key/value on the configuration map (refer to the README, and add the following to get a UTF-8 encoding):

     customConfigurationMap.put("charset","UTF-8");
    
    打赏 评论

相关推荐 更多相似问题