API REST de Facturación Computarizada (Bolivia)
Recuerde que para acceder a nuestra api de facturación computarizada, debe solicitarlo desde nuestros formularios de contacto, una vez habilitada la API se le asignara una instancia a la cual podra enviar las peticiones desde su aplicación o cliente REST.
Autenticación y autorización
Endpoint: POST /api/v1.0.0/users/get-token/
Body:
{"username": "nombre_de_usuario", "password": "contraseña_demo"}
Response:
{
"response": "ok",
"code": 200,
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJRwczpcL1wvbW9ub2J1c2luZXNzLnNpbnRpY2JvbGl2aWEubmV0IiwiYXVkIjoiaHR0cHM6XC9cL21vbm9idXNpbmVzcy5zaW50aWNib2xpdmlhLm5ldCIsImlhdCI6MTYwMTg0NTM1MCwibmJmIjoxNjAxODQ1MzUwLCJ1c2VyIjp7InVzZXJfaWQiOjEwLCJ1c2VybmFtZSI6InJhdWwudmlycm",
"user": {
"user_id": 10000,
"first_name": "Usuario",
"last_name": "VDemo",
"username": "demo@dominio.com",
"email": "",
"status": "enabled",
"role_id": 709,
"store_id": 165,
"last_modification_date": "2020-10-04 16:59:44",
"creation_date": "2020-10-04 16:56:52",
"avatar": "https://google.com/images/nobody.png",
"meta": {
"_phone": null
}
}
}
}
Todas las solicitudes posteriores deben tener en las cabeceras el token obtenido.
Authorization: Bearer [token]
Crear Factura
Endpoint: POST /api/invoices/
Body:
{
"customer": "Miranda",
"nit_ruc_nif": "4898632",
"subtotal": 37,
"total": 37,
"invoice_date_time": "2020-10-04 15:25:00",
"currency_code": "BOB",
"items": [
{
"product_code": "COD-0001",
"product_name": "Hamburquesa",
"price": 25,
"quantity": 1,
"total": 25
},
{
"product_code": "COD-00011",
"product_name": "Coca cola 250ml",
"price": 6,
"quantity": 2,
"total": 12
}
]
}
Parametro | Valor |
customer |
Nombre completo del cliente Tipo de valor: String |
nit_ruc_nif |
Numero de identificación tributaria Tipo de valor: String |
subtotal |
Subtotal de la factura Tipo de valor: Decimal |
total |
Monto total de la factura Tipo de valor: Decimal |
invoice_date_time |
Fecha de la generacion de la factura Formato: Y-m-d H:i:s |
current_code |
La moneda para la factura Valores:
|
Obtener QR
Endpoint: GET /api/invoices/[identificador_factura]/qr
Body:
Response:
{
"response": "ok",
"code": 200,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAAAFIAAABSAQMAAAD94hHYAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABPElEQVQokWXSMQpmOwgGUMFWyFYEW8GtB9IGshXBVnDkvWJ+7yQXcm6RBL8IgPgQ+Tj0+LHFOqW2pKZZrgEJCH69nvr1f23oWzE+tpCg3Of/8/8aUP4bDNNVO6FWWu3hjCx6pkkw7IUYlqEx/didvYLPx08pC+zCx0x2ZFPPaQrgq3clDLtIRCo5TVfaEzycvIcV2Pvb9GB4XzxdSr2zh2P3A8XlEhg+dEvv7cumS1xIw6L3Dvdhp4t8vffXF10PWq6u8dd2l4qTY2f4a95K1gvKNBGsfLCWfgwRFCuFpkU331WrO2p4AT09ejuc4aLs1Hd5TMs2ObhEO9tfV/af5/KclkOQ3cOg01XMXGb2MeAlBGbBaYtizH5Zm2aJhzsv0NeylNYth49v96PjtmkLh1WdzN3D0K2hCQY+/Adl9o5WzIit7QAAAABJRU5ErkJggg==",
"mime_type": "image/png",
"type": "qr",
"encode": "base64"
}
}
Obtener Pdf de la factura
Endpoint: GET /api/invoices/[identificador_factura]/pdf
Body:
Response:
{
"response": "ok",
"code": 200,
"data": {
"buffer": "JVBERi0xLjcKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZwovT3V0bGluZXMgMiAwIFIKL1BhZ2VzIDMgMCBSCi9OYW1lcyAyMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL091dGxpbmVzIC9Db3VudCAwID4+CmVuZG9iagozIDAgb2JqCjw8IC9UeXBlIC9QYWdlcwovS2lkcyBbNiAwIFIKMTcgMCBSCl0KL0NvdW50IDIKL1Jlc29",
"mime": "application/pdf"
}
}
Obtener listado de facturas
Endpoint: GET /api/invoices/
Parametro | Valor |
dfrom |
Fecha inicial Formato: Año-mes-dia |
dto |
Fecha final Formato: Año-mes-dia |
status |
Estado de la factura Posibles valores issued: Emitida void: Anulada |
Body:
Response:
{
"response": "ok",
"code": 200,
"data": [
{
"invoice_id": 3,
"dosage_id": 1,
"customer_id": 65,
"customer": "Miranda",
"user_id": 10,
"store_id": 9,
"nit_ruc_nif": 4898632,
"tax_id": 0,
"tax_rate": 0,
"subtotal": 37,
"total": 37,
"cash": 0,
"invoice_number": 1,
"control_code": "E6-7F-92-5B",
"authorization": "329847238957",
"invoice_date_time": "2020-10-04 15:25:00",
"invoice_limite_date": "2018-09-30",
"currency_code": "BOB",
"status": "issued",
"last_modification_date": "2020-10-04 17:03:34",
"creation_date": "2020-10-04 17:03:34",
"items": [
{
"item_id": 4,
"invoice_id": 3,
"store_id": 0,
"product_id": 0,
"product_code": "COD-0001",
"product_name": "Hamburquesa",
"price": 25,
"quantity": 1,
"total": 25,
"last_modification_date": "2020-10-04 17:03:34",
"creation_date": "2020-10-04 17:03:34"
},
{
"item_id": 5,
"invoice_id": 3,
"store_id": 0,
"product_id": 0,
"product_code": "COD-00011",
"product_name": "Coca cola 250ml",
"price": 6,
"quantity": 2,
"total": 12,
"last_modification_date": "2020-10-04 17:03:34",
"creation_date": "2020-10-04 17:03:34"
}
]
},
{
"invoice_id": 4,
"dosage_id": 3,
"customer_id": 65,
"customer": "Miranda",
"user_id": 10,
"store_id": 9,
"nit_ruc_nif": 4898632,
"tax_id": 0,
"tax_rate": 0,
"subtotal": 37,
"total": 37,
"cash": 0,
"invoice_number": 1,
"control_code": "7A-7A-7C-A3",
"authorization": "23424589749875",
"invoice_date_time": "2020-10-04 15:25:00",
"invoice_limite_date": "2020-10-31",
"currency_code": "BOB",
"status": "issued",
"last_modification_date": "2020-10-04 17:23:26",
"creation_date": "2020-10-04 17:23:26",
"items": [
{
"item_id": 6,
"invoice_id": 4,
"store_id": 0,
"product_id": 0,
"product_code": "COD-0001",
"product_name": "Hamburquesa",
"price": 25,
"quantity": 1,
"total": 25,
"last_modification_date": "2020-10-04 17:23:26",
"creation_date": "2020-10-04 17:23:26"
},
{
"item_id": 7,
"invoice_id": 4,
"store_id": 0,
"product_id": 0,
"product_code": "COD-00011",
"product_name": "Coca cola 250ml",
"price": 6,
"quantity": 2,
"total": 12,
"last_modification_date": "2020-10-04 17:23:26",
"creation_date": "2020-10-04 17:23:26"
}
]
}
]
}
Anular factura
Endpoint: GET /api/invoices/[identificador_factura]/void