curl -X POST https://sandbox.layerfi.com/v1/businesses/{business_id}/invoices/${invoice_id}/delete \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
{
"data": {
"type": "Invoice",
"id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
"business_id": "83d8fb80-31ee-4d57-b684-44b4aaa5e01f",
"external_id": "019234",
"status": "SENT",
"sent_at": "2024-04-02T09:02:00Z",
"due_at": "2023-04-02T09:02:00Z",
"paid_at": null,
"voided_at": null,
"invoice_number": "1",
"recipient_name": "John Doe",
"line_items": [
{
"id": "e6a491dd-9c22-4403-a54f-32d741a7ec67",
"invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
"account_identifier": null,
"description": null,
"product": "Cleaner Solution Pro",
"unit_price": 1299,
"quantity": "2.00",
"subtotal": 2598,
"discount_amount": 0,
"sales_taxes_total": 218,
"sales_taxes": [
{
"tax_account": {
"type": "Tax_Name",
"name": "CALIFORNIA_VAT"
},
"amount": 218
}
],
"total_amount": 2816
},
{
"id": "44f06385-3ef5-4517-8095-eeedaf2054ab",
"invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
"account_identifier": null,
"description": null,
"product": "Full drain cleaning service",
"unit_price": 25000,
"quantity": "1.00",
"subtotal": 25000,
"discount_amount": 0,
"sales_taxes_total": 0,
"total_amount": 25000
}
],
"subtotal": 27598,
"additional_discount": 250,
"additional_sales_taxes_total": 0,
"tips": 0,
"total_amount": 27566,
"outstanding_balance": 27566,
"payment_allocations": [],
"imported_at": "2024-04-19T02:23:59.902537Z",
"updated_at": null,
"transaction_tags": []
}
}
Deleting an invoice should only be used when an invoice was improperly created.
curl -X POST https://sandbox.layerfi.com/v1/businesses/{business_id}/invoices/${invoice_id}/delete \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
{
"data": {
"type": "Invoice",
"id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
"business_id": "83d8fb80-31ee-4d57-b684-44b4aaa5e01f",
"external_id": "019234",
"status": "SENT",
"sent_at": "2024-04-02T09:02:00Z",
"due_at": "2023-04-02T09:02:00Z",
"paid_at": null,
"voided_at": null,
"invoice_number": "1",
"recipient_name": "John Doe",
"line_items": [
{
"id": "e6a491dd-9c22-4403-a54f-32d741a7ec67",
"invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
"account_identifier": null,
"description": null,
"product": "Cleaner Solution Pro",
"unit_price": 1299,
"quantity": "2.00",
"subtotal": 2598,
"discount_amount": 0,
"sales_taxes_total": 218,
"sales_taxes": [
{
"tax_account": {
"type": "Tax_Name",
"name": "CALIFORNIA_VAT"
},
"amount": 218
}
],
"total_amount": 2816
},
{
"id": "44f06385-3ef5-4517-8095-eeedaf2054ab",
"invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
"account_identifier": null,
"description": null,
"product": "Full drain cleaning service",
"unit_price": 25000,
"quantity": "1.00",
"subtotal": 25000,
"discount_amount": 0,
"sales_taxes_total": 0,
"total_amount": 25000
}
],
"subtotal": 27598,
"additional_discount": 250,
"additional_sales_taxes_total": 0,
"tips": 0,
"total_amount": 27566,
"outstanding_balance": 27566,
"payment_allocations": [],
"imported_at": "2024-04-19T02:23:59.902537Z",
"updated_at": null,
"transaction_tags": []
}
}
curl -X POST https://sandbox.layerfi.com/v1/businesses/{business_id}/invoices/${invoice_id}/delete \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
The API will respond with the previous state of the now deleted invoice.