VER MANUAL
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
date_default_timezone_set('America/Panama');
require_once 'sdk2/sdk2.php';
$datos['xml']='carpeta/almacenar_factura123.xml';
$datos['rFE']['gDGen']['dNroDF']='0000086797';
$datos['rFE']['gDGen']['dSeg']='502242845';
$datos['rFE']['gDGen']['dFechaEm']='AUTO';
$datos['rFE']['gDGen']['gEmis']['dTfnEm']['0']='123-4567';
$datos['rFE']['gDGen']['gEmis']['dCorElectEmi']['0']='demo@siteck.com.mx';
$datos['PAC']['usuario']='844084-1-504061';
$datos['PAC']['pass']='pruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebaprueba';
$datos['PAC']['QR']='CEA4A5457603B609E05349D1950A8972CEA4A5457604B609E05349D1950A8972CEA4A5457605B609E05349D1950A8972CEA4A5457606B609E05349D1950A8972';
$datos['conf']['cer']='certificados/certificado_kit.cer';
$datos['conf']['pass']='Tb1DOwrrxeLnjYxR70pr';
$res = mf_genera_fepanama($datos);
echo '<h1>Respuesta Generar XML y Timbrado</h1>';
foreach ($res AS $variable => $valor) {
$valor = htmlentities($valor);
echo "<b>[$variable]=</b>$valor<hr>";
}
VER MANUAL
VER VIDEO
xml=C:\sdk2\timbrados\factura123.xml
[rFE]
[rFE.gDGen]
dNroDF=0000086797
dFechaEm=AUTO
dSeg=502242845
[rFE.gDGen.gEmis]
[rFE.gDGen.gEmis.dTfnEm]
0=123-4567
[rFE.gDGen.gEmis.dCorElectEmi]
0=demo@siteck.com.mx
[PAC]
usuario=844084-1-504061
QR=CEA4A5457603B609E05349D1950A8972CEA4A5457604B609E05349D1950A8972CEA4A5457605B609E05349D1950A8972CEA4A5457606B609E05349D1950A8972
pass=pruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebaprueba
[conf]
pass=Tb1DOwrrxeLnjYxR70pr
cer=c:\sdk2\certificados\certificado_kit.cer
Pasos:
- Instalar el ejecutable SDK2.exe
- Crear un archivo llamado c:\alguna_carpeta\factura.ini
- Ejecutar en linea de comandos c:\sdk2\timbrar64.bat "c:\alguna_carpeta\factura.ini"
- Ver archivo de respuesta en c:\alguna_carpeta\factura
_respuesta.ini
Desde C#, VB, VFP, etc... utiliza la función para ejecutar comandos del sistema; los nombres comunes tienen nombre system, exec, shell_exec o similares los cuales variara su sintaxis según el lenguaje de programación
VER MANUAL
DESCARGAR PROYECTO C# FACTURA BASICA
MFSDK sdk;
sdk = new MFSDK();
sdk.Iniciales.Add("MODOINI", "DIVISOR");
sdk.Iniciales.Add("RESPUESTA_UTF8", "SI");
sdk.Iniciales.Add("xml", @"C:\sdk2\timbrados\factura123.xml");
//#NODO [rFE]
MFObject rFE = new MFObject("rFE");
//#NODO [rFE/gDGen]
MFObject rFE_gDGen = new MFObject("gDGen");
rFE_gDGen["dNroDF"] = "0000086797";
rFE_gDGen["dFechaEm"] = "AUTO";
rFE_gDGen["dSeg"] = "502242845";
//#NODO [rFE/gDGen/gEmis]
MFObject rFE_gDGen_gEmis = new MFObject("gEmis");
//#NODO [rFE/gDGen/gEmis/dTfnEm]
MFObject rFE_gDGen_gEmis_dTfnEm = new MFObject("dTfnEm");
rFE_gDGen_gEmis_dTfnEm["0"] = "123-4567";
rFE_gDGen_gEmis.AgregaSubnodo(rFE_gDGen_gEmis_dTfnEm);
//#NODO [rFE/gDGen/gEmis/dCorElectEmi]
MFObject rFE_gDGen_gEmis_dCorElectEmi = new MFObject("dCorElectEmi");
rFE_gDGen_gEmis_dCorElectEmi["0"] = "demo@siteck.com.mx";
rFE_gDGen_gEmis.AgregaSubnodo(rFE_gDGen_gEmis_dCorElectEmi);
rFE_gDGen.AgregaSubnodo(rFE_gDGen_gEmis);
//#NODO [conf]
MFObject conf = new MFObject("conf");
conf["pass"] = "Tb1DOwrrxeLnjYxR70pr";
conf["cer"] = @"C:\sdk2\certificados\certificado_kit.cer";
//#NODO [PAC]
MFObject PAC = new MFObject("PAC");
PAC["usuario"] = "844084-1-504061";
PAC["QR"] = "CEA4A5457603B609E05349D1950A8972CEA4A5457604B609E05349D1950A8972CEA4A5457605B609E05349D1950A8972CEA4A5457606B609E05349D1950A8972";
PAC["pass"] = "pruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebaprueba";
//#Agrega Nodos
rFE.AgregaSubnodo(rFE_gDGen);
sdk.AgregaObjeto(rFE);
sdk.AgregaObjeto(PAC);
sdk.AgregaObjeto(conf);
//#Ejecuta KIT
SDKRespuesta respuesta = sdk.Timbrar(@"C:\sdk2\timbrar32.bat", @"C:\sdk2\timbrados\", "factura", false);
//Muestra el archivo ini
//textBox1.Text = sdk.Ini;
//Muestra la respuesta de timbrado
//textBox2.Text = respuesta.RespuestaOriginalSDK;
// Se notifica que el SDK se ejecutó
string mensaje = string.Format("Código: {0}\r\nMensaje: {1}", respuesta.Codigo_MF_Numero, respuesta.Codigo_MF_Texto);
MessageBox.Show(this, mensaje, Application.ProductName, MessageBoxButtons.OK, respuesta.Codigo_MF_Numero == "0" ? MessageBoxIcon.Information : MessageBoxIcon.Warning);
VER MANUAL
VER VIDEO APIREST JSON C#
CODIGO FUENTE C#
variable modo (formato de respuesta) : JSON(default)|INI|DIVISOR|SERIALIZE|XML
variable json :
NOTA: parametro conf/cer es el archivo en base64
{
"rFE": {
"gDGen": {
"dNroDF": "0000086797",
"dSeg": 502242845,
"dFechaEm": "AUTO",
"gEmis": {
"dTfnEm": [
"123-4567"
],
"dCorElectEmi": [
"demo@siteck.com.mx"
]
}
}
},
"PAC": {
"usuario": "844084-1-504061",
"pass": "pruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebaprueba",
"QR": "CEA4A5457603B609E05349D1950A8972CEA4A5457604B609E05349D1950A8972CEA4A5457605B609E05349D1950A8972CEA4A5457606B609E05349D1950A8972"
},
"conf": {
"cer": "QmFnIEF0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ElVdlZLZm53ZjlESgpnellUOFY2alFRNzQzVk8yNkIrVmQyY3kwalhHTjlFbjI4ZXBXNGZpUFFidSsyZWZ6a0h1emt1K0JORTFsVVBxClhPb3c4R1hJdk13UlViRzJseEpGYkVNeFAxNmtNbHdiZWd1ckFYVjkKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=",
"pass": "Tb1DOwrrxeLnjYxR70pr"
}
}
Ejemplo PHP
$datospost['json']=$datos_factura_json;
$datospost['modo']='JSON';
$res=callAPI('POST', $url, $datospost);
echo $res;
function callAPI($method, $url, $data){
$curl = curl_init();
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => false, // follow redirects
CURLOPT_MAXREDIRS => 1, // stop after 10 redirects
CURLOPT_ENCODING => "", // handle compressed
CURLOPT_USERAGENT => "api-mf", // name of client
CURLOPT_AUTOREFERER => true, // set referrer on redirect
CURLOPT_CONNECTTIMEOUT => 10, // time-out on connect
CURLOPT_TIMEOUT => 10, // time-out on response
);
curl_setopt_array($curl, $options);
switch ($method){
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
default:
if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}
// OPTIONS:
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'APIKEY: 111111111111111111111',
'test-test: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// EXECUTE:
$result = curl_exec($curl);
if(!$result){die("Connection Failure");}
curl_close($curl);
return $result;
}
Ejemplo C#
using System.Net;
using System.Collections.Specialized;
using System.Text;
var wb = new WebClient();
var data = new NameValueCollection();
string url = "https://pruebasws.siteck.mx/api/";
data["modo"] = "JSON";
data["json"] = entrada.Text;
byte[] responseArray = wb.UploadValues(url, "POST", data);
respuestaws.Text = Encoding.Default.GetString(responseArray);
Ejemplo VB .net
Dim wb As var = New WebClient()
Dim data As var = New NameValueCollection()
Dim url As String = "https://pruebasws.siteck.mx/api/"
data("modo") = "JSON"
data("json") = entrada.Text
Dim responseArray() As Byte = wb.UploadValues(url,"POST",data)
respuestaws.Text = Encoding.Default.GetString(responseArray)
Ejemplo Python
#check if module is installed "python -m pip install requests"
import requests
import json
url = "https://pruebasws.siteck.mx/api/"
datos = {
"modo": "JSON",
"json": """
INSERTAR STRING JSON AQUI
"""
}
response = requests.post(url, datos,verify=False)
print(response.text)
VER MANUAL
VER VIDEO APIREST TXT C#
variable modo (formato de respuesta) : JSON(default)|INI|DIVISOR|SERIALIZE|XML
variable txt :
NOTA: parametro conf/cer es el archivo en base64
[rFE]
[rFE.gDGen]
dNroDF=0000086797
dFechaEm=AUTO
dSeg=502242845
[rFE.gDGen.gEmis]
[rFE.gDGen.gEmis.dTfnEm]
0=123-4567
[rFE.gDGen.gEmis.dCorElectEmi]
0=demo@siteck.com.mx
[PAC]
usuario=844084-1-504061
QR=CEA4A5457603B609E05349D1950A8972CEA4A5457604B609E05349D1950A8972CEA4A5457605B609E05349D1950A8972CEA4A5457606B609E05349D1950A8972
pass=pruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebapruebaprueba
[conf]
cer=QmFnIEF0dHJpYnV0ZXMKICAgIGZyaWVuZGx5TmFtZTogY249W0ZdIEZPUk1VTEFSSU9TIENPTUVSQ0lBTEVTIFNBIC0gODQ0MDg0LTEtNTA0MDYxIC0gMDAgLSBDSEFOSVMgVEVKQURBIE1BTlVFTCBSSUNBUkRPLG91PUZBQ1RVUkEgRUxFQ1RST05JQ0Esbz1GSVJNQSBFTEVDVFJPTklDQSxjPVBBIE5vbi1y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datospost['txt']=$datos_factura_txt;
$datospost['modo']='JSON';
$res=callAPI('POST', $url, $datospost);
echo $res;
function callAPI($method, $url, $data){
$curl = curl_init();
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => false, // follow redirects
CURLOPT_MAXREDIRS => 1, // stop after 10 redirects
CURLOPT_ENCODING => "", // handle compressed
CURLOPT_USERAGENT => "api-mf", // name of client
CURLOPT_AUTOREFERER => true, // set referrer on redirect
CURLOPT_CONNECTTIMEOUT => 10, // time-out on connect
CURLOPT_TIMEOUT => 10, // time-out on response
);
curl_setopt_array($curl, $options);
switch ($method){
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
default:
if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}
// OPTIONS:
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'APIKEY: 111111111111111111111',
'test-test: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// EXECUTE:
$result = curl_exec($curl);
if(!$result){die("Connection Failure");}
curl_close($curl);
return $result;
}
Ejemplo C#
var wb = new WebClient();
var data = new NameValueCollection();
string url = "https://pruebasws.siteck.mx/api/";
data["modo"] = "TXT";
data["txt"] = entrada.Text;
byte[] responseArray = wb.UploadValues(url, "POST", data);
respuestaws.Text = Encoding.Default.GetString(responseArray);
Ejemplo VB .net
Dim wb As var = New WebClient()
Dim data As var = New NameValueCollection()
Dim url As String = "https://pruebasws.siteck.mx/api/"
data("modo") = "TXT"
data("txt") = entrada.Text
Dim responseArray() As Byte = wb.UploadValues(url,"POST",data)
respuestaws.Text = Encoding.Default.GetString(responseArray)
Ejemplo Python
#check if module is installed "python -m pip install requests"
import requests
import json
url = "https://pruebasws.siteck.mx/api/"
datos = {
"modo": "JSON",
"txt": """
INSERTAR STRING JSON AQUI
"""
}
response = requests.post(url, datos,verify=False)
print(response.text)
RESPUESTA DEL WEBSERVICE
Este es un ejemplo de los elementos y el formato cambia segun el ambiente
NOTAS:
PHP : respuesta en array
TXT : respuesta en TXT
C# : respuesta en SDKRespuesta respuesta
API REST : respuesta JSON, XML, TXT, SERIALIZADO
WS SOAP WSDL : variables del WS