FISCALISTO / API
Online stores
Connect Shopify, WooCommerce, Tiendanube, Mercado Libre, Amazon, Mercado Pago, Conekta or Openpay: each paid order becomes a self-invoicing ticket, and whatever nobody invoices goes into the global invoice.
Each paid order from the store becomes a self-invoicing ticket of the issuer, with the order's folio (SHOP-1001, WEB-1001, TN-1001, ML-2000001234, AMZ-702-1234567-1234567). Your buyer invoices it on the issuer's portal, and whatever nobody invoices goes on its own into the period's global invoice. A cancelled order, or one fully refunded, cancels its ticket as long as nobody has invoiced it.
| Store | How it connects | Where it runs |
|---|---|---|
| Shopify | POST /v1/store_connections with the store app's keys | In Fiscalisto: nothing to install |
| WooCommerce | POST /v1/store_connections with a key from the store's REST API, or the Fiscalisto Autofactura plugin | In Fiscalisto (or the plugin, on your server) |
| Tiendanube | POST /v1/store_connections and the owner authorizes in Tiendanube | In Fiscalisto |
| Mercado Libre | POST /v1/store_connections and the seller authorizes in Mercado Libre | In Fiscalisto |
| Amazon | POST /v1/store_connections and the seller authorizes in Seller Central | In Fiscalisto: reads its orders every hour |
Whoever invoices without coding connects the same stores in the app, in Ventas › Tiendas en línea.
An order arrives only once even if the store sends it several times: the folio is the same ticket. Only orders in pesos with a total above 0 are recorded; the rest end up in the connection's last_error.
Shopify
- In Shopify's Dev Dashboard, create an app in the store's organization with the
read_ordersandwrite_ordersscopes, and install it on the store. - Connect it with its Client ID and Client secret:
curl https://api.fiscalisto.com/v1/store_connections \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "shopify",
"shop": "mi-tienda.myshopify.com",
"client_id": "8c1f0e7a2b3d4e5f6a7b8c9d0e1f2a3b",
"client_secret": "shpss_…",
"settings": { "product_key": "53101600" }
}'Fiscalisto registers the webhooks for paid orders, cancellations and refunds, and verifies each one's signature with the Client secret, which is stored encrypted and never shown. The app's keys only work for stores in the same Shopify organization (store_connection_failed otherwise). An old custom app, made in the store's admin, connects with its shpat_… token in access_token and its API secret key in client_secret.
Each order carries its self-invoicing link in the fiscalisto.autofactura_url metafield. To show it on the order status page and in the confirmation email, add it to your templates:
{% if order.metafields.fiscalisto.autofactura_url %}
<a href="{{ order.metafields.fiscalisto.autofactura_url }}">Facturar mi compra</a>
{% endif %}Mercado Libre
Create the connection without keys. It stays pending with authorize_url: send the seller there to authorize Fiscalisto on their Mercado Libre account. On return it's active (and, if you sent return_url, it goes back to your page with store_connection and status). return_url is followed only once: if the seller opens the same link again, they see Fiscalisto's page with the result.
curl https://api.fiscalisto.com/v1/store_connections \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "mercadolibre",
"return_url": "https://su-plataforma.com/tiendas",
"settings": { "product_key": "43211500" }
}'- If the buyer left their tax data in Mercado Libre (RFC, name, regime and postal code), the invoice is stamped when the order is paid. If it's missing, the ticket waits on the portal. With
"auto_invoice": falseit always waits. - Each invoice of an order (the buyer's, stamped here or on the portal) is uploaded to Mercado Libre as the order's tax document, with its XML and PDF.
- A Mercado Libre account connects to only one issuer at a time.
The ticket's total is the items' (total_amount): the shipping Mercado Libre charges isn't included.
How each order becomes a ticket
settings decides the ticket's line item and keys. It changes with POST /v1/store_connections/{id} and applies from the next order.
| Field | What it does |
|---|---|
product_key | The c_ClaveProdServ of what you sell. Required, unless every item in your orders is in your catalog by SKU. |
unit_key, iva | The c_ClaveUnidad and the IVA rate included in prices (16 % if you don't say). |
description | A fixed line item. If you don't set it, the order and its items: «Pedido 1001: Playera (2), Gorra». |
folio_prefix | What goes before the order number: SHOP-, WEB-, TN-, ML- or AMZ- if you don't set it. |
payment_forms | The c_FormaPago for each gateway (shopify_payments, paypal…), WooCommerce payment method (bacs, cod, stripe…) or Tiendanube one (credit_card, wire_transfer…), or Mercado Libre payment type (credit_card, debit_card, account_money, ticket…). |
notify_buyer | WooCommerce and Tiendanube: send the buyer their invoicing link (WooCommerce, as a customer note on the order; Tiendanube, by email). true if you don't say. |
payment_form | The one used when the order's isn't in payment_forms. |
An item whose SKU (sku in Shopify, WooCommerce and Tiendanube; seller_sku in Mercado Libre; SellerSKU in Amazon) is the sku of one of your products (POST /v1/products) goes as its own line item in lines, with the product (prd_…), its keys, its IVA and its withholdings. The order's other items go with product_key, each with its name. The order's total is split among the line items by each item's price, to the cent. If no SKU is in the catalog, the ticket carries one line item, as before.
Without payment_forms, a Shopify card is 04, PayPal and Mercado Pago 31, cash on delivery 01 and deposit 03. In Mercado Libre, credit 04, debit 28, account money 06, cash 01 and transfer 03; anything else, 31 (payment intermediary). In WooCommerce, transfer (bacs) 03, cash on delivery 01, card 04 and PayPal or Mercado Pago 31. In Amazon, 31 (Amazon collects for you), except cash on delivery, 01. Shopify's tip goes in tip and isn't part of the invoice.
Orders that didn't arrive
If you connected the store after selling, or a webhook got lost, POST /v1/store_connections/{id}/import_orders brings the paid orders since since (up to 31 days back, 200 at a time). An order that was already a ticket isn't repeated.
Disconnect
DELETE /v1/store_connections/{id} deletes its webhooks and keys, and orders stop arriving. The tickets it already made remain and can be invoiced.
WooCommerce
In WordPress, open WooCommerce › Ajustes › Avanzado › API REST (Settings › Advanced › REST API), press Añadir clave (Add key) with Lectura/Escritura (Read/Write) permissions and connect it:
curl https://api.fiscalisto.com/v1/store_connections \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "woocommerce",
"site": "https://mitienda.com",
"consumer_key": "ck_…",
"consumer_secret": "cs_…",
"settings": { "product_key": "52151600" }
}'Fiscalisto checks that the store sells in pesos and registers its webhooks (order.created and order.updated), signed with a secret of its own. An order in Procesando (Processing) or Completado (Completed) is a ticket; a Cancelado (Cancelled) or Reembolsado (Refunded) one cancels its own. The invoicing link stays on the order (_fiscalisto_autofactura_url) and, with notify_buyer, as a customer note, which WooCommerce emails them. The store must be at a public https address.
If you'd rather have everything run on your server, the Fiscalisto Autofactura plugin does the same with one of your API keys (Desarrolladores › Llaves): it records each paid order with POST /v1/tickets, shows the self-invoicing link on the thank-you page, in Mi cuenta (My account) and in the order emails, and cancels the ticket if the order is cancelled or fully refunded. If Fiscalisto doesn't answer, it retries on its own. It's configured in WooCommerce › Ajustes › Fiscalisto. Install it from WordPress, in Plugins › Añadir nuevo plugin (Add new plugin): search for «Fiscalisto Autofactura» (on WordPress.org).
Tiendanube
Like Mercado Libre: create the connection without keys ("platform": "tiendanube"), send the store owner to authorize_url and, once authorized, it's active with its webhooks (order/paid, order/cancelled, order/voided and app/uninstalled). A paid order is a ticket; a cancelled or voided one cancels its own. With notify_buyer, the buyer gets the invoicing link by email, in the store's name. If the app is uninstalled in Tiendanube, the connection becomes disconnected. A store connects to only one issuer at a time.
Amazon
Create the connection without keys ("platform": "amazon") and send the seller to authorize_url, in Amazon.com.mx's Seller Central. Amazon doesn't notify by webhook: Fiscalisto reads the orders that changed every hour. An Unshipped, PartiallyShipped or Shipped order is a ticket; a Canceled one cancels its own; Pending ones wait to be paid. Amazon doesn't allow writing to its buyers outside its messaging, so you give them the invoicing link (for example, in the shipping message); whatever nobody invoices goes into the global invoice. A seller account connects to only one issuer at a time.
Mercado Pago, Conekta and Openpay
Your payment gateway's charges connect too: each paid charge is a ticket (MP-, CK-, OP-), a refunded or cancelled one cancels its own, and with notify_buyer the customer gets the invoicing link by email when the charge carries their email. Fiscalisto never uses a notification's body: it reads the charge again with your key.
- Mercado Pago: the production
access_token(APP_USR-…). Mercado Pago doesn't allow registering webhooks by API, so Fiscalisto reads the approved payments every hour. - Conekta:
private_key(key_…). Fiscalisto registers the orders webhook. - Openpay:
merchant_id,private_key(sk_…) andsandboxfor your test merchant. Fiscalisto registers the webhook; if Openpay asks to verify it, the code shows inlast_error.
curl https://api.fiscalisto.com/v1/store_connections \
-H "Authorization: Bearer $FISCALISTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "conekta",
"private_key": "key_…",
"settings": { "product_key": "86121700" }
}'Was this page helpful?
Self-invoicing
Record each sale as a ticket and let your buyer invoice themselves, on your page or on the issuer's portal; whatever nobody invoices goes into the global invoice.
Recurring invoices
Rent, subscriptions and retainers: an invoice the issuer stamps on its own every month, week or day, at the time you choose, without you scheduling anything.