GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — facturapi-java/README.md at main · FacturAPI/facturapi-java

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
140 lines (100 loc) · 3.46 KB
/

README.md

Copy path

File metadata and controls

140 lines (100 loc) · 3.46 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Facturapi Java SDK

Official Java SDK for Facturapi.

Español: README.es.md

Facturapi helps developers generate valid electronic invoices (CFDI) in Mexico.

If you've used Stripe or a similar API-first payments or billing SDK, the surface here should feel familiar: typed models on the way out, flexible JSON objects on the way in.

Make sure you have a Facturapi account and your API key.

CI Maven Central Java

Compatibility

  • Java 11+
  • Kotlin/JVM
  • Android 8.0 (API level 26) o superior
  • Spring Boot, Jakarta EE, Quarkus, Micronaut, and other JVM server apps

Installation

Maven:

<dependency>
  <groupId>io.facturapi</groupId>
  <artifactId>facturapi-java</artifactId>
  <version>2.0.0</version>
</dependency>

Gradle:

implementation("io.facturapi:facturapi-java:2.0.0")

Quickstart

import io.facturapi.Facturapi;
import java.util.Map;

Facturapi facturapi = new Facturapi("sk_test_...");

var customer = facturapi.customers().create(Map.of(
  "legal_name", "Mi Empresa SA de CV",
  "tax_id", "XAXX010101000",
  "tax_system", "601",
  "email", "[email protected]"
), null);

var invoice = facturapi.invoices().create(Map.of(
  "customer", customer.getId(),
  "items", java.util.List.of(Map.of("quantity", 1, "product", "prod_123"))
), null);

System.out.println(invoice.getId());

Payroll catalogs

var deductions = facturapi.nominaCatalogs().searchDeductions(Map.of("q", "001"));
var perceptions = facturapi.nominaCatalogs().searchPerceptions(Map.of("q", "001"));

Uploads

import java.io.File;

var organization = facturapi.organizations().uploadLogo(
  "org_123",
  new File("logo.png")
);

var updated = facturapi.organizations().uploadCertificate(
  "org_123",
  new File("certificate.cer"),
  new File("certificate.key"),
  "secret"
);

Errors

import io.facturapi.FacturapiException;

try {
  facturapi.customers().retrieve("cus_123");
} catch (FacturapiException e) {
  System.out.println(e.getMessage());
  System.out.println(e.getStatusCode());
  System.out.println(e.getErrorCode());
  System.out.println(e.getErrorPath());
}

Design

  • Inputs use flexible JSON dictionaries (Map<String, Object>).
  • Outputs are typed Java models (Invoice, Customer, SearchResult<T>, etc.).
  • Errors expose the useful API error fields directly on FacturapiException.
  • Auth uses Authorization: Bearer <apiKey>.

Configuration

Facturapi facturapi = Facturapi.builder("sk_test_...")
  .apiVersion("v2")
  .timeout(java.time.Duration.ofSeconds(20))
  .build();

Custom HTTP Client

For tests or advanced setups, you can inject your own OkHttpClient:

import okhttp3.OkHttpClient;

Facturapi facturapi = Facturapi.builder("sk_test_...")
  .httpClient(new OkHttpClient())
  .build();

Documentation

Full docs: https://docs.facturapi.io

Support

  • Issues: open a GitHub issue
  • Email: [email protected]
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.