douzhang5984 2018-11-20 11:03 采纳率: 100%
浏览 124
已采纳

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?
  • 写回答

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");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?