Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A simple gem to parse the PagSeguro transaction notification.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 pagseguro_catcher.gemspec



This is a little gem that helps you parsing the return of the Pagseguro’s transaction notification.
You can find more info about the notification API here.


The first thing you’ll need to do is to enable the Pagseguro’s transaction notification. When you do that, you’ll receive a post in the URL that you just set up.

When you’re done, it’s time to set up the PagseguroCatcher params. If you’re using Rails, the best way to do that is creating an initializer and set the following parameters:

PagseguroCatcher.configure do |config|
  config.token = "YOUR CONFIG TOKEN" = ""

Every time that some transaction occurs, you’ll receive a post in the URL that you set up on Pagseguro. When that post hits your app, you’ll do this (again, assuming you’re in a Rails application):

  if params[:notificationCode] && params[:notificationType]
    transaction =[:notificationCode], params[:notificationType]).check
    # your implementation logic goes here

  render :nothing => true

The transaction object contains the all the magic: # => Thu, 10 Feb 2011 16:13:41 -0300
transaction.payment_method_type # => Cartão de crédito

You can also access others sections as well: # => "John Doe"
transaction.amount.gross # => 199.99 # => "01452002"

Looping each item is easy too:

transaction.each_item do |item|
  puts item.description

Notebook Prata
Notebook Rosa



  • write the documentation
  • implement a nice way to rescue the ::Checker#check method, when the request isn’t successfull or the return is invalid


  • maybe some nice logs?

Contributing to pagseguro_catcher

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Copyright © 2011 Matias H. Leidemer. See LICENSE.txt for
further details.

Something went wrong with that request. Please try again.