NAME

WebService::BR::AceitaFacil - Perl low level implementation of the https://aceitafacil.com.br brazilian payment gateway.

SYNOPSIS

use WebService::BR::AceitaFacil;

my $gateway = new WebService::BR::AceitaFacil( api_key => 'YOUR SECRET KEY' );

# Or, if you want to use the sandbox:
my $gateway = new WebService::BR::AceitaFacil( api_key => 'YOUR SECRET KEY', target => 'sandbox' );

# Create a new bankslip and the the PDF download URL of the document.
my $response = $gateway->post(
 'operation',
 { buyer => {
    id => "..."
   },
   items => [{
     vendor      => { id => "..." },
     amount      => 123.45,
     description => 'My cool product'
   }],
   payment_method => "BOLETO_UNREGISTERED"
 }
);

# Error
if ( !$response || $response->{ErrorStatus} || !$response->{boleto_url} ) {

 print $response->{ErrorStatus} || 'UNKNOWN ERROR';  

# OK
} else {

 print $response->{boleto_url};

}


# Check if a previously created bankslip was is paid or not.
my $invoice = $gateway->get( 'invoice/< INVOICE ID HERE >' );

print $invoice->{paid_amount};
print $invoice->{total_amount};

DESCRIPTION

This is a straight brindge to the AceitaFacil.com.br payment gateway API.

SEE ALSO

Please check AceitaFacil's full API docs at http://www.aceitafacil.com.br/ (you will need an API key to access this page).

AUTHOR

Diego de Lima, <diego_de_lima@hotmail.com>

SPECIAL THANKS

This module was kindly made available by the https://modeloinicial.com.br/ team.

COPYRIGHT AND LICENSE

Copyright (C) 2017 by Diego de Lima

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.