PagSeguro::API - API for PagSeguro payment gateway
my $p = PagSeguro::API->new; # configure $p->email('foo@bar.com'); $p->token('95112EE828D94278BD394E91C4388F20'); # new payment request object my $payment = $p->payment_request; $payment->reference('XXX'); $payment->notification_url('http://google.com'); $payment->redirect_url('http://url_of_love.com.br'); # adding new item $payment->add_item( id => $product->id, description => $product->title, amount => $product->price, weight => $product->weight ); my $response = $payment->request; # error die "Error: ". $response->error if $response->error; my $data = $response->data; say $data->{payment_url};
PagSeguro Gateway Payment API implementation.
PagSeguro is a Brazilian very common payment gateway and for this case, the documentation that will provided here will be write in Portuguese.
If you don't speak Portuguese and need to use this module please contact author for some help or ask something.
Now In Portuguese
Este módulo foi criado para prover uma implementação à API do PagSeguro em Perl de forma simples e pratica.
This is a very new module and may contain some bugs. Please do not use in production.
Este módulo é muito novo e pode conter alguns bugs. Por favor não use em produção.
Este módulo requer os seguintes módulos não core para funcionar corretamente...
my $p = PagSeguro::API->new; $p->email('joe.doe@sualoja.com.br'); $p->token('seu token'); # environment: default é 'production' $p->environment('sandbox');
Para utilizar a API do PagSeguro você precisa ter um e-mail e um token cadastrados.
e-mail
token
A flag c<< environment >> serve para configurar seu ambiente para rodar em sandbox (ambiente de testes do PagSeguro) ou em produção.
Esta classe disponibiliza os seguintes métodos...
my $p = PagSeguro::API->new; my $p = PagSeguro::API->new( email => 'joe.doe@sualoja.com.br', token => 'seu token' );
Este é o construtor da classe e pode receber como parâmetro, diretamente, as credenciais de autenticação para utilizar a API como email, token e environment.
email
environment
my $payment = $p->payment_request;
Este método retorna um objeto da classe PagSeguro::API::Payment.
PagSeguro::API::Payment
my $payment = $p->notification;
Este método retorna um objeto da classe PagSeguro::API::Notification.
PagSeguro::API::Notification
my $payment = $p->transaction;
Este método retorna um objeto da classe PagSeguro::API::Transaction.
PagSeguro::API::Transaction
Algumas funcionalidades que estão por vir.
* Utilizar um módulo mais performático para substituir o LWP::UserAgent * Melhorias na documentação e criação de Cookbook * Concluir a implementação de toda a API de consulta de transações * Melhoria nos testes
Daniel Vinciguerra <daniel.vinciguerra at bivee.com.br>
To install PagSeguro::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PagSeguro::API
CPAN shell
perl -MCPAN -e shell install PagSeguro::API
For more information on module installation, please visit the detailed CPAN module installation guide.