Skip to content

Latest commit

 

History

History
125 lines (92 loc) · 3.32 KB

README-en.md

File metadata and controls

125 lines (92 loc) · 3.32 KB

Java SDK for APIs Efí Pay

Banner APIs Efí Pay

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.

Requirements

  • Java >= 7.0

Tested with

java 7.0, 8.0, 13.0 and 18.0

Installation

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>

Getting started

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 */
}

For development environment

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);

For production environment

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);

Running tests

To run the test suite:

mvn clean test jacoco:report

Running examples

To run some existing examples follow the steps described at sdk-java-examples-apis-efi.

Additional Documentation

The full documentation with all available endpoints is in https://dev.efipay.com.br.

Changelog

CHANGELOG