Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pat/pippin
A PayPal Rails Engine that handles IPNs
https://github.com/pat/pippin
Last synced: 17 days ago
JSON representation
A PayPal Rails Engine that handles IPNs
- Host: GitHub
- URL: https://github.com/pat/pippin
- Owner: pat
- License: mit
- Created: 2012-01-04T06:13:39.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-11-13T05:33:56.000Z (about 12 years ago)
- Last Synced: 2024-11-30T04:02:53.864Z (23 days ago)
- Language: Ruby
- Homepage:
- Size: 112 KB
- Stars: 14
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
- Changelog: HISTORY
Awesome Lists containing this project
README
h1. Pippin
Pippin is a Rails Engine for processing PayPal IPN requests. It automatically adds a route to your Rails application that validates and processes IPNs.
If you want to do something with those IPN objects (and I recommend you do), then all you need to do is attach a subscriber to the notification, and that'll fire as each valid IPN is received.
*Using Rails 3.0?* Then you better jump back to the "0.1.1 release":https://github.com/pat/pippin/tree/v0.1.1 of this library, which does not use ActiveSupport::Notifications.
h2. Installation and Usage
Just add it to your Gemfile:
gem 'pippin', '~> 1.0.0'
Then somewhere (perhaps in an initializer), subscribe to the notifications:
ActiveSupport::Notifications.subscribe('received.ipn') do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
ipn = event.payload[:ipn]
# use IPN data
ipn.params # => {'business' => '[email protected]', 'txn_type' => ...}
endThere are also notifications fired using the txn_type parameter as the prefix, if you wish to subscribe to certain types:
ActiveSupport::Notifications.subscribe('subscr_signup.ipn') do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
ipn = event.payload[:ipn]# A subscription sign up has happened. Do something!
endAny parameters with the suffix '_date' in their name will automatically be translated from PayPal's ugly date string to an appropriate Time object.
When constructing your form that redirects people to PayPal, you'll want to set the @notify_url@ parameter to use Pippin's URL that has automatically been added to your routes: @'pippin/ipns'@.
h2. Contributing
Contributions are very much welcome - but keep in mind the following:
* Keep patches in a separate branch.
* Write tests for your patches.
* Don't mess with the version or history file. I'll take care of that when the patch is merged in.h2. Credits
Copyright (c) 2012, Pippin is developed and maintained by Pat Allan, and is released under the open MIT Licence.