cancel
Showing results for 
Search instead for 
Did you mean: 

IPN listener didn't provide 'verified' status for successful recurring payment

Member

IPN listener didn't provide 'verified' status for successful recurring payment

We are using IPN for receiving customer details for recurring payments. In testing, using sandbox account for recurring payment is working well and its IPN listener provides 'verified' status. so my requirement is fulfill in that case, But in live site, my IPN listener didn't provide 'verified' status for successful recurring payment. I attached part of my code(implementing IPN) for references

  def ipn_paypal
    response = validate_IPN_notification(request.raw_post)
    case response
    when "VERIFIED"
      if params[Smiley Tongueayment_status] == "Completed" && params[:receiver_email] == "#{ENV['PAYPAL_MERCHANT_EMAIL']}"
        contributor = build_contributor(params)
        #trigger mail for successful payment
      end
    when "INVALID"
        #need require actions
    else
    end
    head Smiley Surprisedk
  end

 def validate_IPN_notification(raw)
    uri = URI.parse("#{ENV['PAYPAL_IPN_URL']}")
    http = Net::HTTP.new(uri.host, uri.port)
    http.open_timeout = 60
    http.read_timeout = 60
    http.verify_mode = OpenSSL:Smiley FrustratedSL::VERIFY_PEER
    http.use_ssl = true
    response = http.post(uri.request_uri, raw,
                         'Content-Length' => "#{raw.size}",
                         'User-Agent' => "My custom user agent"
                       ).body
  end

. I don't know why? I followed https://github.com/paypal/ipn-code-samples/blob/master/ruby/paypal_ipn_rails.rb these documentation to implement IPN my site

1 REPLY
Member

Re: IPN listener didn't provide 'verified' status for successful recurring payment

I found the solution. I missed to attach the variable `cmd=_notify-validate`to Verify that response to an IPN in live site. The correct IPN URL is https://ipnpb.paypal.com/cgi-bin/webscr?cmd=_notify-validate