Harry
Harry

Reputation: 4773

Paypal - Auto return in paypal returning null object

I configured paypal auto return but its returning null object but it works fine when auto return is off means when user click on the button "return to my website" it gives me all the values which I can use as to save order detail.

Following is form which I am posting to paypal sendbox

 <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions"> 
    <input type="hidden" name="cmd" value="_notify-synch">
    <input type="hidden" name="business" value="${paypalAccount}">
    <input type="hidden" name="item_name" value="OPP Plan">
    <input type="hidden" name="item_number" value="${pid}">
    <input type="hidden" name="groupId" value="1">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="return" value="${returnURL}">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cancel_return" value="${cancelURL}">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="a3" value="${price}.00">
    <input type="hidden" name="p3" value="1">
    <input type="hidden" name="t3" value="M">
    <input type="hidden" name="src" value="1">
    <input type="hidden" name="sra" value="1">
    <input type="submit" value="Choose plan">

In my controller I am reading values like

 @RequestMapping(value = "/confirmPayment")
public ModelAndView showPaymentDetail(Model model,
        @ModelAttribute PaypalBean paypalBean) {
    UserDetailedBean userLoggedIn = (UserDetailedBean) userService.getUserDetailFromSpringSecurity();

    if (paypalBean != null && paypalBean.getPayer_status().equalsIgnoreCase("verified")){
   //reading values here

}

Please let me know if anything else is required.

Upvotes: 0

Views: 524

Answers (1)

Gerzie
Gerzie

Reputation: 2330

When you turn on Auto-Return are you also enabling Payment Data Transfer (PDT)? With PDT enabled the information returned to your site after a payment has completed will be a GET.

In the code provided you have rm=2 which means you want POST information returned. If that is what you were expecting you wouldn't get it with PDT enabled.

When you're testing with Auto-Return on are you waiting the time for the redirect to complete or clicking the link on the interim page?

Upvotes: 1

Related Questions