/ Published in: Rails

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
Comments
