Portuguese | English
SDK in JAVA for integration with Efí APIs for emission Pix, bank slips, carnet, credit card, subscription, payment link, marketplance, Pix through Open Finance, among other features. For more informations about parameters and values see our website.
- Java >= 7.0
java 7.0, 8.0, 13.0 and 18.0
Via gradle:
implementation 'br.com.efipay.efisdk:sdk-java-apis-efi:1.2.1'
Via maven:
<dependency>
<groupId>br.com.efipay.efisdk</groupId>
<artifactId>sdk-java-apis-efi</artifactId>
<version>1.2.1</version>
</dependency>
Require the module and packages:
import br.com.efi.efisdk.EfiPay;
import br.com.efi.efisdk.exceptions.EfiPayException;
Although the web services responses are in json format, the sdk will convert any server response to a JSONObject or a Map<String, Object>. The code must be within a try-catch and exceptions can be handled as follow:
try {
/* code */
} catch(EfiPayException e) {
/* EfiPay's api errors will come here */
} catch(Exception ex) {
/* Other errors will come here */
}
Instantiate the module parameters using client_id
, client_secret
, sandbox
equal to true and certificate
with the name of the approval certificate:
JSONObject options = new JSONObject();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("certificate", "./certs/developmentCertificate.p12");
options.put("sandbox", true);
EfiPay efi = new EfiPay(options);
Or
Map<String, Object> options = new HashMap<String, Object>();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("certificate", "./certs/developmentCertificate.p12");
options.put("sandbox", true);
EfiPay efi = new EfiPay(options);
Instantiate the module parameters using client_id
, client_secret
, sandbox
equals false and certificate
with the name of the production certificate:
JSONObject options = new JSONObject();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("certificate", "./certs/productionCertificate.p12");
options.put("sandbox", false);
EfiPay efi = new EfiPay(options);
Or
Map<String, Object> options = new HashMap<String, Object>();
options.put("client_id", "client_id");
options.put("client_secret", "client_secret");
options.put("certificate", "./certs/productionCertificate.p12");
options.put("sandbox", false);
EfiPay efi = new EfiPay(options);
To run the test suite:
mvn clean test jacoco:report
To run some existing examples follow the steps described at sdk-java-examples-apis-efi.
The full documentation with all available endpoints is in https://dev.efipay.com.br.