Input data.
This version needs the stamping URL, the Token [or user and password] and an stamped XML.
Output data.
- Version 4
- CFDI (with TFD)
- CadenaOriginalSat
- noCertificadoSat
- noCertificadoCFDI
- UUID
- selloSAT
- selloCFDI
- fechaTimbrado
- QRCode
Token Use
Get an Access Token using our libraries, or alternatively use the Infinite Token
Steps to stamps and electronic invoice using the Java SDK
- Step1:
Create a new project in Eclipse
- Step 2:
Create a class or a function to make the stamping.
- Step 3:
Inside the code of our project we should call the stamping of an XML.
1234567891011121314151617181920212223242526272829303132333435363738394041424344import java.io.IOException;import java.nio.file.Files;import java.nio.file.Paths;import Exceptions.AuthException;import Exceptions.GeneralException;import Services.Stamp.SWStampService;import Utils.Responses.SuccessV4Response;public class Timbrado {public static void main(String a[]) {String xml;try {xml = new String(Files.readAllBytes(Paths.get("C:\\Out\\2018-10-17T14-03-23-890.xml")));SWStampService api = new SWStampService("demo", "123456789", "http://services.test.sw.com.mx");SuccessV4Response response = null;response = (SuccessV4Response) api.Stamp(xml, "V4");if(response.Status.equals("success")) {System.out.println(response.cfdi);System.out.println(response.qrCode);System.out.println(response.cadenaOriginalSAT);System.out.println(response.selloCFDI);System.out.println(response.selloSAT);System.out.println(response.noCertificadoCFDI);System.out.println(response.noCertificadoSAT);System.out.println(response.fechaTimbrado);System.out.println(response.uuid);}else {System.out.println(response.message);System.out.println(response.messageDetail);}} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (AuthException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (GeneralException e) {// TODO Auto-generated catch blocke.printStackTrace();}}} - Step 4
Now you are able to see the response variable with the response of stamping service.- Example of a response with an error
- Example of a response with success
- Example of a response with an error
You can download the class that we used for this example in the following link.