Return to Snippet

Revision: 28156
at July 2, 2010 09:23 by gmericksen


Initial Code
def paypal_ipn
  begin
     # Handle regular IPN
     notify = Paypal::Notification.new(request.raw_post)
     invoice = Payment.find(notify.invoice)
     receive_invoice_payment(notify, invoice) if notify.acknowledge
   end
 
   render :nothing => true
 end
  
def receive_invoice_payment(notify, invoice)
  if notify.complete? and invoice.amount == notify.amount
    invoice.update_attribute(:status, 'paid')
  else
   # raise invoice payment errors
  end
end

Initial URL


Initial Description


Initial Title
Rails IPN Sample

Initial Tags
rails

Initial Language
Rails