Skip to main content

Introduction

Functional examples of all billing services offered in the Efí API


API

In order to offer a way for clients and integrators to see in practice how our bills are issued, we provide several ready-made integration examples with Efí's APIs demonstrating the boleto/Bolix, carnê, credit card, Pix, subscriptions (recurring billing), payment link, and payment split modes, thus being able to experience our services before diving into development.





In addition to the possibility of running these tests, we provide all the codes used in these examples available for download. It is worth noting that, in these examples, the PHP SDK was used for integration with the APIs.


Running Examples

To run these examples in your environment, you need to create an Efí account and also an application to obtain the credentials.



Important!

After downloading these examples, don't forget to insert your credentials in the credentials.json file, which are the Client_Id and Client_Secret according to the environment used (Homologation or production), and remember that the sandbox parameter is boolean and has 2 possible values, according to the environment, being: sandbox => true equals to the Homologation environment and sandbox => false equals to the Production environment.

To use the Pix example, you must also inform in the credentials.json file, in the certificate attribute, the directory ./certs/, adding the name of your certificate in .pem format. Here you find tips for generating your certificate and converting it from .p12 to .pem. It is also necessary, in the ./pix/emitir_pix.php file, in the $body variable, to insert your Pix key registered in Efí in the "chave" => "" parameter.

For the examples involving the issuance of _credit card_, it is necessary that you inform your account identifier in line 1 of the script contained in the ./assets/js/payment-token.js file. This script is used to obtain the payment_token. It is important to emphasize that this code is specific according to the environment used (production or Homologation). See in this link how to correctly obtain your payment_token.


As this is a purely illustrative example for educational purposes, it is necessary for you to adapt it to your needs. We are not responsible for the use of this example without the necessary adjustments for your production environment.