Clara also supports uploading and accessing electronic invoice XML files, specifically for transactions in Mexico. These invoices can be retrieved through our API to support audit, compliance, or reconciliation processes.
๐งพ When a Transaction Has an Invoice
If a transaction has invoice:
- The
hasInvoice
field is set totrue
- Youโll receive a link to download them
- URLs are valid for 12 hours
๐ Endpoint Format
GET /v3/transactions/{uuid}/invoices
Use this endpoint to retrieve XML invoice details and metadata associated with a specific transaction.
๐งช Example: Getting Invoices for a Transaction
In the following example, we will get the invoice information for the transaction with the UUID "47f8ed9e-4d7b-450b-ad6a-f1d83e3ce4e1" in Mexico.
๐ค cURL Request
curl -X GET
"https://public-api.mx.clara.com/api/v3/transactions/47f8ed9e-4d7b-450b-ad6a-f1d83e3ce4e1/invoices" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
๐ฅ Sample JSON Response
{
"transactionUuid": "47f8ed9e-4d7b-450b-ad6a-f1d83e3ce4e1",
"invoices": [
{
"invoiceId": "54cd6b23-5146-437f-b133-879c432e6776",
"invoiceNumber": null,
"taxRegime": "621",
"issuer": {
"rfc": "CLARA123XML",
"businessName": "CLARA"
},
"taxReceipts": {
"cfdi": "G03",
"paymentMethod": "Q4"
},
"tax": {
"retained": {
"isr": 0.75,
"iva": null,
"ieps": null
},
"transferred": {
"iva": 0.0,
"ieps": 0.0
}
},
"amount": {
"total": 400.00,
"subTotal": 300.00,
"currency": "MXN"
},
"documentDate": "2024-10-01",
"xmlStatus": "Vigente",
"xmlCode": "S โ Comprobante obtenido satisfactoriamente."
}
]
}
โ ๏ธ The download URL is temporary and will expire 12 hours after generation. Ensure you download and store the file before it expires.
โน๏ธ Note: The example provided contains mock data and does not reflect real tax calculations or financial details.