Enviar CFDI
A continuación se explica como enviar un CFDI.
Podemos enviar un CFDI haciendo uso del siguiente parámetro:
Parámetro | Tipo | Requerido | Detalles |
---|---|---|---|
cfdi_uid | string | Requerido | Indica el UID o UUID del CFDI que deseas enviar. Ejemplo: 55c0fdc67593d |
Construcción de la URL
Host: https://facturaonline.com.mx/api (producción) / https://sandbox.facturaonline.com.mx/api (sandbox)
Endpoint: /v4/cfdi40/cfdi_uid/email
Ejemplo: https://facturaonline.com.mx/api/v4/cfdi40/55c0fdc67593d/email
Tip
Para probar el código de ejemplo es necesario que reemplaces el texto Tu API key por el API KEY de tu cuenta, e Tu Secret key por el SECRET KEY correspondiente. Además de reemplazar cfdi_uid por el UID del CFDI que deseas enviar.
Ejemplo de enviar CFDI
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '{ HOST }/v4/cfdi40/61d4c3fe77dd8/email',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'F-PLUGIN: 9d4095c8f7ed5785cb14c0e3b033eeb8252416ed',
'F-Api-Key: Tu API key',
'F-Secret-Key: Tu Secret key'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': '{ HOST }/v4/cfdi40/61d4c3fe77dd8/email',
'headers': {
'Content-Type': 'application/json',
'F-PLUGIN': '9d4095c8f7ed5785cb14c0e3b033eeb8252416ed',
'F-Api-Key': 'Tu API key',
'F-Secret-Key': 'Tu Secret key'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "{ HOST }/v4/cfdi40/61d4c3fe77dd8/email"
payload = ""
headers = {
'Content-Type': 'application/json',
'F-PLUGIN': '9d4095c8f7ed5785cb14c0e3b033eeb8252416ed',
'F-Api-Key': 'Tu API key',
'F-Secret-Key': 'Tu Secret key'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
require "uri"
require "json"
require "net/http"
url = URI("{ HOST }/v4/cfdi40/61d4c3fe77dd8/email")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["F-PLUGIN"] = "9d4095c8f7ed5785cb14c0e3b033eeb8252416ed"
request["F-Api-Key"] = "Tu API key"
request["F-Secret-Key"] = "Tu Secret key"
response = http.request(request)
puts response.read_body
Respuesta
Ejemplo de envio exitoso de CFDI
{
"response": "success",
"uid": "6169fc02637e1",
"message": "Hemos enviado tu Factura con exito al e-mail's [email protected]"
}