DLL Stamping API Doc
To use these methods in your project, you only need to add the dll_timbrado_1.8.4.2.zip library. To learn how to add it, please follow this link: 2.5.1.1. DLL Documentation.
| ProgID | SF.timbrar |
Main methods:
String |
cancelar(String user, String pass, String pathToDerCertCSD, String pathToDerKeyCSD,
String contrasenaKey, String UUIDs, int produccion) Cancel a CFD or CFDI. |
String |
enviarSolicitudCancelacion(String user, String pass, String rutaSolicitud (xml), int produccion) Submit a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012. |
String |
recibe(String user, String pass, rfcReceptor, String pathToCFDI, String configuraciones, int produccion) It receives a CFD or CFDI, validates it and, if it passes all the validations configured in the implementation, it stores it and returns an acknowledgment of e-document. |
String |
timbrarCFDI(String user, String pass, String pathToCFDI, int produccion) Stamp a CFDI. |
String |
timbrarCFD(String user, String pass, pathCFD, pathToDerCertCSD, pathToDerKeyCSD, String contrasenaCSD, int produccion) He receives a CFD, he stamps it. |
String |
validar(String user, String pass, rfcReceptor, String pathToCFDI, String configuraciones, int produccion) Receives a CFD or CFDI, validates it. |
Complementary methods:
String |
enviarSolicitudCancelacionBase64(String user, String pass, String base64Data, int produccion) Submit a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012. |
String |
cancelarWriteResponse(String user, String pass, String pathToDerCertCSD, String pathToDerKeyCSD,
String contrasenaKey, String UUIDs, String pathToWrite, int produccion) Cancel a CFDI or CFD and write the received response to an .xml file. |
String |
enviarSolicitudCancelacionWriteResponse(String user, String pass, String base64Data, int produccion) Submit a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012. |
String |
enviarSolicitudCancelacionWriteResponseBase64(String user, String pass, String base64Data, int produccion) Submit a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012. |
String |
timbrarCFDIWriteResponse(String user, String pass, String pathToCFDI, String pathToWrite, int produccion) Stamp a CFDI and write the received response to an .xml file. |
String |
timbrarCFDWriteResponse(String user, String pass, pathCFD, pathToDerCertCSD, pathToDerKeyCSD, String contrasenaCSD, String pathToWrite, int produccion) It receives a CFD, stamps it, and writes the received response to an .xml file. |
Detailed description of the methods
Cancel
String cancelar(String user,
String pass,
String pathToDerCertCSD,
String pathToDerKeyCSD,
String contrasenaCSD,
String UUIDs,
int produccion)
- Cancels a given voucher and returns a String with the server's response in XML format.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String pathToDerCertCSD- Path to the certificate file (.cer file).String pathToDerKeyCSD- Path to the certificate key ( .key file).String contrasenaCSD- Certificate password.String UUIDs- Cancellation chain specifying the UUID of the CFDI to be cancelled, the cancellation reason key, and the UUID that replaces the document to be cancelled. If there is more than one string, they must be separated by commas, all within the same chain.- In the following format:
UUID|Motivo|UuidSustitucion int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A String containing the response in encoded XML format.
- Example response
- Download this example: Cancelar_Response.zip
timbrarCFDI
String timbrarCFDI(String user,
String pass,
String pathToCFDI,
int produccion)
- Stamp a given CFDI and return a String with the server's response in encoded XML format.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String pathToCFDI- Path to the CFDI file to be stamped.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A String containing the response in XML format.
- Example response
- Download this example: CFDI_Response.zip
timbrarCFD
String timbrarCFD(String user,
String pass,
String pathCFD,
String pathToDerCertCSD,
String pathToDerKeyCSD,
String contrasenaCSD,
int produccion)
- It receives an unsigned CFD or CFDI, signs it with the provided CSD, and stamps it. It returns a string with the server's response in encoded XML format.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String pathCFD- Path to the CFD file to be stamped.String pathCert- Path to the certificate file (.cer file).String pathKey- Path to the certificate key (.key file).String contrasenaCSD- Certificate password.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A String containing the response in XML format.
- Example response
- Download this example: response.timbrarcfd.zip
timbrarCFDWriteResponse
String timbrarCFD(String user,
String pass,
String pathCFD,
String pathToDerCertCSD,
String pathToDerKeyCSD,
String contrasenaCSD,
String pathToWrite,
int produccion)
- It receives a CFD or CFDI without a digital seal, seals it with the provided CSD and stamps it. It writes the server's response in UTF-8 encoded XML format, returning the path and filename. The filename will follow this format: CFDI_Response_UUID.xml. Example: CFDI_Response_44D1222C-F5D5-47B0-A30E-D011F651FEC2.xml
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String pathCFD- Path to the CFD file to be stamped.String pathCert- Path to the certificate file (.cer file).String pathKey- Path to the certificate key (.key file).String contrasenaCSD- Certificate password.String pathToWrite- Path to the directory where the .xml file with the generated response is stored.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A string containing the full path where the file was stored, including its name.
cancelarWriteResponse
String cancelar(String user,
String pass,
String pathToDerCertCSD,
String pathToDerKeyCSD,
String contrasenaKey,
String UUIDs,
String pathToWrite,
int produccion)
- Cancel a given voucher and write the server's response in UTF-8 encoded XML format, returning the path and filename. The filename will follow the following format: Cancelar_Response_UUID.xml. Example: Cancelar_Response_44D1222C-F5D5-47B0-A30E-D011F651FEC2.xml
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String pathToDerCertCSD- Path to the certificate file (.cer file).String pathToDerKeyCSD- Path to the certificate key (.key file).String contrasenaKey- Certificate password.String UUIDs- Cancellation string specifying the UUID of the CFDI to be cancelled, the cancellation reason key and the UUID that replaces the document to be cancelled. If there is more than one chain, they must be separated by commas, all within the same string. In the format:UUID|Motivo|UuidSustitucionString pathToWrite,- Path to the directory where the .xlm file with the generated response will be stored.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A String containing the full path where the file was stored, including its name.
timbrarCFDIWriteResponse
String timbrarCFDI(String user,
String pass,
String pathToCFDI,
String pathToWrite,
int produccion)
- Stamp a given CFD and write the server response in UTF-8 encoded XML format, Returns the path and name under which the file was generated. The file name will follow the following format: CFDI_Response_UUID.xml. Ejemplo: CFDI_Response_44D1222C-F5D5-47B0-A30E-D011F651FEC2.xml
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String pathToCFDI- Path to the CFDI file to be stamped.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A string containing the full path where the file was stored, including its name.
validate
String validar(String user,
String pass,
String rfcReceptor,
String configuraciones,
String pathToCFDI,
int produccion)
- It receives a CFD or CFDI, validates it, and returns a response indicating the validation result.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.-
String rfcReceptor-RFC of the recipient to whom the receipts are addressed. This must correspond to an issuer of the implementation (it may not exist and can be registered if the user has permission to do so). -
String configuraciones- An array of Configuration objects that specify the configurations for validating the e-document being sent. If no receipt is sent, the configurations applicable to the e-document recipient will be used. String pathToCFDI- Path to the CFDI file to be validated.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- An XML string containing the response from the web service.
recibe
String recibe(String user,
String pass,
String rfcReceptor,
String configuraciones,
String pathToCFDI,
int produccion)
- It receives a CFD or CFDI, validates it and, if it passes all the validations configured in the implementation, it stores it and returns an acknowledgment of e-document.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.-
String rfcReceptor-RFC of the recipient to whom the receipts are addressed. This must correspond to an issuer of the implementation (it may not exist and can be registered if the user has permission to do so). -
String configuraciones- An array of Configuration objects that specify the configurations for validating the e-document being sent. If no e-document is sent, the configurations applicable to the receipt recipient will be used. String pathToCFDI- Path to the CFDI file to be validated.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- An XML string containing the response from the web service.
-
Configurations for receive() and validate()
-
The configurations must be specified in a single string with the syntax codigo:valor,codigo:valor
example: ValidarAddendasSinNamespacePropio:false -
Code Type Description PorcentajeToleranciaAritmeticaSubtotalTotalNuméricoIndicates the percentage tolerance margin that will be accepted to validate the total and subtotal of the receipt. It is represented on a scale of 0 to 100. PorcentajeToleranciaAritmeticaImpuestosNuméricoIndicates the percentage tolerance margin that will be accepted for validating tax calculations. It is represented on a scale of 0 to 100. PorcentajeToleranciaAritmeticaConceptosNuméricoIndicates the percentage tolerance margin that will be accepted to validate the calculations in the concepts. It is represented on a scale of 0 to 100. ValidarAddendasSinNamespacePropioBooleanIndicates whether to validate addenda in the e-document that do not have a specified namespace. ValidarAritmeticaBooleanIndicates whether or not to validate the arithmetic of the e-document. ValidarAddendasConNamespacePropioBooleanIndicates whether to validate addenda in the e-document that have a specified namespace. RechazarImporteTotalNegativoBooleanIndicate whether to reject the e-document because it has a negative total amount (less than 0). ValidarSerieBooleanIndicates whether to validate the approvals of the e-document series.
enviarSolicitudCancelacion
String enviarSolicitudCancelacion(String user,
String pass,
String rutaSolicitud (xml),
int produccion)
- Send a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012 and return the response received in an XML language string.
- Parámetros:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String rutaSolicitud-Path to the .xml file that contains the cancellation request.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- An XML string containing the response from the web service.
enviarSolicitudCancelacionBase64
String enviarSolicitudCancelacionBase64(String user,
String pass,
String base64Data,
int produccion)
- Send a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012 and return the response received in an XML language string.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String base64Data- The cancellation request information encoded in base64 is expected.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- An XML string containing the response from the web service.
enviarSolicitudCancelacionWriteResponse
String enviarSolicitudCancelacionWriteResponse(String user,
String pass,
rutaSolicitud (xml),
int produccion)
- Submit a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012.
- Parameters:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String rutaSolicitud- Path to the .xml file that contains the cancellation request.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A string containing the path and filename where the received response was written.
enviarSolicitudCancelacionWriteResponseBase64
String enviarSolicitudCancelacionWriteResponseBase64(String user,
String pass,
String base64Data,
int produccion)
- Send a cancellation request according to the standard defined in Annex 20 of the Miscellaneous Tax Resolution (RMF) for 2012 and return the response received in an XML language string.
- Parámetros:
String user- The username (usually an email address) used to authenticate and connect to your implementation.String pass- The user password.String base64Data-The cancellation request information encoded in base64.int produccion- Only the values 1 and 0 are accepted. Indicates the server to which the request will be made;
0=TESTING
1=PRODUCCION
- Returns:
- A string containing the path and filename where the received response was written.
Ejemplo de solicitud cancelación de acuerdo al anexo 20
- Para la documentación sobre la solicitud de cancelación de la sección I inciso C y Sección II inciso C del Anexo 20
Consultar Estandar técnico.
- Para la especificación de cómo hacer la firma puede visitar el enlace externo: XML Signature Syntax and Processing.
- Para la validación de la firma puede visitar: Verificador de Firma digital XML.
Descargar ejemplo cancelación de CFDI 4.0
Descargar ejemplo de cancelación de Retenciones e información de Pagos 2.0
Motivos de cancelación:
-
Clave Descripción 01 Comprobante emitido con errores con relación. 02 Comprobante emitido con errores sin relación. 03 No se llevó a cabo la operación. 04 Operación nominativa relacionada en una factura global. Cuando se seleccione la clave 01, se deberá habilitar un campo adicional para registrar el folio fiscal que sustituye al comprobante.