# Paypal IPN callback - how to?

**URL:** <https://www.ruby-forum.com/t/paypal-ipn-callback-how-to/129977>\
**Category:** Rails\
**Created:** [February 23, 2008, 2:44pm UTC](https://www.ruby-forum.com/t/paypal-ipn-callback-how-to/129977 "2008-02-23T14:44:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fonziguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f05b48/32.png) [@fonziguy](https://www.ruby-forum.com/u/fonziguy)\
**Post date:** [February 23, 2008, 2:44pm UTC](https://www.ruby-forum.com/t/paypal-ipn-callback-how-to/129977/1 "2008-02-23T14:44:54Z")

</div>

I’m using Paypal to make payments through my Rails app and I have IPN  
setup so that when rails receives notification from Paypal, a record is  
activated. This all works fine.

However, Paypal sends the notification multiple times. I think this is  
because my controller is not notifying Paypal that it has received the  
IPN call. I’m using ActiveMerchant.

I tested the script on [http://www.eliteweaver.co.uk/testing/ipntest.php](http://www.eliteweaver.co.uk/testing/ipntest.php)  
(which is an IPN testing environment) and it said that my script was not  
posting back to them.

Here is my code:

def notify

# Create a notify object we must

notify = Paypal::Notification.new(request.raw\_post)

if notify.acknowledge  
#record transaction details here…  
begin  
if notify.complete?  
#do some validation and then activate record  
else  
#Reason to be suspicious  
end

```
rescue => e
  #There's a bug
  raise
ensure
  #make sure we logged everything we must
end

```

end  
render :nothing =\> true  
end

Does anyone know how to send the callback to Paypal to inform them that  
I’ve received the IPN?

---

<div class="post-metadata">

**Author:** ![fonziguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f05b48/32.png) [@fonziguy](https://www.ruby-forum.com/u/fonziguy)\
**Post date:** [February 27, 2008, 7:00am UTC](https://www.ruby-forum.com/t/paypal-ipn-callback-how-to/129977/2 "2008-02-27T07:00:42Z")

</div>

i a m a new one ruby on rails i want learn more things place help  
me

On Feb 23, 6:44 pm, Lee M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![fonziguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f05b48/32.png) [@fonziguy](https://www.ruby-forum.com/u/fonziguy)\
**Post date:** [February 27, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/paypal-ipn-callback-how-to/129977/3 "2008-02-27T15:24:37Z")

</div>

On 2/23/08, Lee M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> (which is an IPN testing environment) and it said that my script was not  
> #record transaction details here…  
> ensure  
> #make sure we logged everything we must  
> end  
> end  
> render :nothing =\> true  
> end
> 
> Does anyone know how to send the callback to Paypal to inform them that  
> I’ve received the IPN?

That’s what the notify.acknowledge should be doing.

## However, I suspect that you need to somehow modify active merchant to use the url for that testing site instead of paypal itself.

Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![fonziguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f05b48/32.png) [@fonziguy](https://www.ruby-forum.com/u/fonziguy)\
**Post date:** [May 18, 2009, 3:31pm UTC](https://www.ruby-forum.com/t/paypal-ipn-callback-how-to/129977/4 "2009-05-18T15:31:05Z")

</div>

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?

Thanks,  
Jason

On Feb 23 2008, 9:44 am, Lee M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
