CodeIgniter 4 Integration PagSeguro API

Codacy Badge Quality Gate Status

Under development. Last tested version here.



See the archive


See the archive


See the archive


  • Billet generation by API
  • Payment by credit card
  • Callback when updating any payment status
  • Validation with a unique reference code
  • Sending email confirmation of order status
  • Boleto in Lightbox in a modal
  • Loader to wait for payment request
  • Logs for each transaction status

Structure library:

Function Reason
getSession Generate a mandatory payment session
requestNotification Receive PagSeguro notification of status change
paymentBillet Generate payment by bank slip
paymentCard Generate payment by credit card
_store Adds a transaction to the database
_edit Edit a transaction status in the database
_notifyStatus Sends email notification about order status
_getChamada Make the cURL call to the PagSeguro server
  • In the / Demo folder contains the version already installed on Codeigniter 4.

  • Instructions for use:

use App\Libraries\PagSeguro;

$pagseguro = new PagSeguro();

//Puxar a function necessária
  • It is necessary to create an account on PagSeguro Sandbox. The documentation can be accessed through the link Documentation PagSeguro. Change Config/PagSeguro.php to access the production URL of PagSeguro when the project is finished.

  • Change the test email provided in PagSeguro . / Views / home in the email field to use in PagSeguro development mode and make payments.

  • To use the notification module at localhost, simply access PagSeguro and simulate a status change.

Error table:

Code Description
1000 Error generating payment session
1001 Incorrect parameters in Pagseguro configuration
1002 Error receiving notification code
1003 There is no transaction code
1004 Error when registering transaction in the boleto type database
1005 Error generating billet type transaction
1006 Error when registering card type transaction
1007 Error generating card type transaction
1008 Error when calling the server


Tests performed in sandbox with name generation and invalid CPF only for testing.

List of all transactions:


Card payment:


Payment slip:


Ci4 Integration Pagseguro

Simplifying access to a payment API

Ci4 Integration Pagseguro Info

⭐ Stars 11
🔗 Source Code
🕒 Last Update 2 years ago
🕒 Created 3 years ago
🐞 Open Issues 9
➗ Star-Issue Ratio 1
😎 Author matheuscastroweb