22
33Official Java SDK for [ Facturapi] ( https://www.facturapi.io ) .
44
5- ## Requirements
5+ Español: [ README.es.md] ( README.es.md )
6+
7+ [ ![ CI] ( https://img.shields.io/github/actions/workflow/status/facturapi/facturapi-java/ci.yml?branch=main&style=for-the-badge&label=CI )] ( https://github.com/facturapi/facturapi-java/actions/workflows/ci.yml )
8+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/io.facturapi/facturapi-java?style=for-the-badge&label=Maven%20Central )] ( https://central.sonatype.com/artifact/io.facturapi/facturapi-java )
9+ [ ![ Java] ( https://img.shields.io/badge/Java-11%2B-ED8B00?style=for-the-badge&logo=openjdk&logoColor=white )] ( https://openjdk.org/ )
10+
11+ ## Compatibility
612
713- Java 11+
8- - Maven 3.8+
14+ - Kotlin/JVM
15+ - Android 8.0 (API level 26) o superior
16+ - Spring Boot, Jakarta EE, Quarkus, Micronaut, and other JVM server apps
917
1018## Installation
1119
20+ Maven:
21+
1222``` xml
1323<dependency >
1424 <groupId >io.facturapi</groupId >
@@ -17,27 +27,75 @@ Official Java SDK for [Facturapi](https://www.facturapi.io).
1727</dependency >
1828```
1929
30+ Gradle:
31+
32+ ``` gradle
33+ implementation("io.facturapi:facturapi-java:1.0.0")
34+ ```
35+
2036## Quickstart
2137
2238``` java
23- import com .facturapi.Facturapi ;
39+ import io .facturapi.Facturapi ;
2440import java.util.Map ;
2541
2642Facturapi facturapi = new Facturapi (" sk_test_..." );
2743
28- var customer = facturapi. customers. create(Map . of(
44+ var customer = facturapi. customers() . create(Map . of(
2945 " legal_name" , " Mi Empresa SA de CV" ,
3046 " tax_id" , " XAXX010101000" ,
3147 " tax_system" , " 601" ,
3248 " email" , " cliente@example.com"
3349), null );
3450
35- var invoice = facturapi. invoices. create(Map . of(
36- " customer" , customer. get( " id " ) . asText (),
51+ var invoice = facturapi. invoices() . create(Map . of(
52+ " customer" , customer. getId (),
3753 " items" , java.util. List . of(Map . of(" quantity" , 1 , " product" , " prod_123" ))
3854), null );
55+
56+ System . out. println(invoice. getId());
57+ ```
58+
59+ ## Uploads
60+
61+ ``` java
62+ import java.io.File ;
63+
64+ var organization = facturapi. organizations(). uploadLogo(
65+ " org_123" ,
66+ new File (" logo.png" )
67+ );
68+
69+ var updated = facturapi. organizations(). uploadCertificate(
70+ " org_123" ,
71+ new File (" certificate.cer" ),
72+ new File (" certificate.key" ),
73+ " secret"
74+ );
3975```
4076
77+ ## Errors
78+
79+ ``` java
80+ import io.facturapi.FacturapiException ;
81+
82+ try {
83+ facturapi. customers(). retrieve(" cus_123" );
84+ } catch (FacturapiException e) {
85+ System . out. println(e. getMessage());
86+ System . out. println(e. getStatusCode());
87+ System . out. println(e. getErrorCode());
88+ System . out. println(e. getErrorPath());
89+ }
90+ ```
91+
92+ ## Design
93+
94+ - Inputs use flexible JSON dictionaries (` Map<String, Object> ` ).
95+ - Outputs are typed Java models (` Invoice ` , ` Customer ` , ` SearchResult<T> ` , etc.).
96+ - Errors expose the useful API error fields directly on ` FacturapiException ` .
97+ - Auth uses ` Authorization: Bearer <apiKey> ` .
98+
4199## Configuration
42100
43101``` java
@@ -46,9 +104,3 @@ Facturapi facturapi = Facturapi.builder("sk_test_...")
46104 .timeout(java.time. Duration . ofSeconds(20 ))
47105 .build();
48106```
49-
50- ## Notes
51-
52- - Uses ` Authorization: Bearer <apiKey> ` .
53- - Supports custom base URL for integration testing.
54- - Includes compatibility aliases (` all ` , ` del ` , ` lisLiveApiKeys ` ).
0 commit comments