I have a PayPal IPN working. Well it did work. Now it doesn''t and I believe it has to do that they now want it to be posted via 443. Can I just change 80 to 443 and be ok? @query = ''cmd=_notify-validate'' request.params.each_pair {|key, value| @query = @query + ''&'' + key + ''='' + value.first if key != ''register/pay_pal_ipn.html/pay_pal_ipn'' } http = Net::HTTP.new(''www.paypal.com'', 80) response = http.post(''/cgi-bin/webscr'', @query) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 Aug 2008, at 15:26, Pål Bergström wrote:> > I have a PayPal IPN working. Well it did work. Now it doesn''t and I > believe it has to do that they now want it to be posted via 443. Can I > just change 80 to 443 and be ok? >you also need to set it to use ssl (just set http.use_ssl to true) Fred> @query = ''cmd=_notify-validate'' > request.params.each_pair {|key, value| @query = @query + ''&'' + key + > ''='' > + value.first if key != ''register/pay_pal_ipn.html/pay_pal_ipn'' } > http = Net::HTTP.new(''www.paypal.com'', 80) > response = http.post(''/cgi-bin/webscr'', @query) > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 Aug 2008, at 15:26, P�l Bergstr�m wrote: > >> >> I have a PayPal IPN working. Well it did work. Now it doesn''t and I >> believe it has to do that they now want it to be posted via 443. Can I >> just change 80 to 443 and be ok? >> > you also need to set it to use ssl (just set http.use_ssl to true) > > FredWhere and how do I add that? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 20 Aug 2008, at 15:26, P�l Bergstr�m wrote: > >> >> I have a PayPal IPN working. Well it did work. Now it doesn''t and I >> believe it has to do that they now want it to be posted via 443. Can I >> just change 80 to 443 and be ok? >> > you also need to set it to use ssl (just set http.use_ssl to true) > > FredIs this correct? http = Net::HTTP.new(''www.paypal.com'', 80) http.use_ssl response = http.post(''/cgi-bin/webscr'', @query) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pål Bergström wrote:> Frederick Cheung wrote: >> On 20 Aug 2008, at 15:26, P�l Bergstr�m wrote: >> >>> >>> I have a PayPal IPN working. Well it did work. Now it doesn''t and I >>> believe it has to do that they now want it to be posted via 443. Can I >>> just change 80 to 443 and be ok? >>> >> you also need to set it to use ssl (just set http.use_ssl to true) >> >> Fred > > Is this correct? > > http = Net::HTTP.new(''www.paypal.com'', 80) > http.use_ssl > response = http.post(''/cgi-bin/webscr'', @query)Another thing related to this. In the paypalipn respons I first check request.post? Is that ok? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason wrote:> Hi, > Did you every get your PayPal IPN script working. If so, did you use a > plugin or custom code? Would you be willing to share this code for > reference? I am looking to accomplish the same task as you. > > Thanks, > Jason > > On Aug 20 2008, 10:26�am, P�l Bergstr�m <rails-mailing-l...@andreas-This is what I have as a IPN script. [code] if request.post? #new @params = params @params[:cmd] = "_notify-validate" @params.delete(:action) @params.delete(:controller) url = URI.parse("https://www.paypal.com/cgi-bin/webscr") req = Net::HTTP::Post.new(url.path) req.set_form_data(@params) sock = Net::HTTP.new(url.host, url.port) sock.use_ssl = true response = sock.start {|http| http.request(req)} item_name = params[:item_name] payment_status = params[:payment_status] payment_amount = params[:mc_gross] payment_currency = params[:mc_currency] payer_email = params[:payer_email] receiver_email = params[:receiver_email] txn_id = params[:txn_id] if response @user = User.find_by_email(payer_email) if @user #find account and update @account = Account.find_by_user_id(@user.id) unless @account @account = Account.new() end @account.status = ''Init'' end if response.body == ''VERIFIED'' if payment_status == ''Completed'' @date = Date.today() + 365 @account.ipn = ''Completed'' @account.status = ''Completed'' @account.amount = payment_amount @account.paypal_id = txn_id @account.expires = @date @account.save @user.status = "Open" @user.expires = @date @user.save(false) else @account.status = ''Not Verified'' @account.save @account.update_attribute(:ipn,''Pending'') end else @account.status = ''Not-Passed'' @account.save end end end render :nothing => true [/code] -- Posted via http://www.ruby-forum.com/.
Hi Pål Bergström, I suggest you use paypal plugin which is available here<http://dist.leetsoft.com/api/paypal/>.. in the sanbox we can generate virtual ipn.. but most of people gave negavtive feedback about ipn.. let me know anything else.... Thanks Arun Sent from Bangalore, KA, India 2009/5/18 Pål Bergström <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Jason wrote: > > Hi, > > Did you every get your PayPal IPN script working. If so, did you use a > > plugin or custom code? Would you be willing to share this code for > > reference? I am looking to accomplish the same task as you. > > > > Thanks, > > Jason > > > > On Aug 20 2008, 10:26�am, P�l Bergstr�m <rails-mailing-l...@andreas- > > This is what I have as a IPN script. > > [code] > > if request.post? > > > > > #new > @params = params > @params[:cmd] = "_notify-validate" > @params.delete(:action) > @params.delete(:controller) > > url = URI.parse("https://www.paypal.com/cgi-bin/webscr") > req = Net::HTTP::Post.new(url.path) > req.set_form_data(@params) > sock = Net::HTTP.new(url.host, url.port) > sock.use_ssl = true > response = sock.start {|http| http.request(req)} > > item_name = params[:item_name] > payment_status = params[:payment_status] > payment_amount = params[:mc_gross] > payment_currency = params[:mc_currency] > payer_email = params[:payer_email] > receiver_email = params[:receiver_email] > txn_id = params[:txn_id] > > > if response > > @user = User.find_by_email(payer_email) > > if @user > #find account and update > @account = Account.find_by_user_id(@user.id) > unless @account > @account = Account.new() > end > @account.status = ''Init'' > end > > if response.body == ''VERIFIED'' > if payment_status == ''Completed'' > @date = Date.today() + 365 > @account.ipn = ''Completed'' > @account.status = ''Completed'' > @account.amount = payment_amount > @account.paypal_id = txn_id > @account.expires = @date > @account.save > @user.status = "Open" > @user.expires = @date > @user.save(false) > else > @account.status = ''Not Verified'' > @account.save > @account.update_attribute(:ipn,''Pending'') > end > else > @account.status = ''Not-Passed'' > @account.save > end > > end > end > > render :nothing => true > > [/code] > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---