Update invoice

PATCH https://api.ecurring.com/invoices/{id}

Update a draft invoice. In accordance with the JSON API specification any missing attribute will be interpreted as if they were included with their current value. It's therefore not neccessary to include every attribute of the invoice during a partial update.

Every attribute that can be set during the creation of an invoice can be updated using a PATCH request to the invoice's resource endpoint. With the exception of the following attribute:

subscription_id
integer
When an invoice is created, the subscription_id will be set as a relationship on the resource. It is not possible to change this afterwards.

Parameters

Replace {id} in the URL with the identifier of the invoice.

Request attributes

invoice_date
datetime
Optional - The date of the invoice. This date must always be on or before today, and the transaction_date. The invoice will automatically be finalised on this date. If left empty, the invoice will not automatically be finalised and if a transaction_date is provided, the invoice_date will automatically be set to the value of the transaction_date.

In ISO 8601 format.
transaction_date
datetime
Optional - The date of the transaction. Once the invoice is finalised, the transaction for this invoice will be scheduled on this date. This date must always be on or after the invoice_date. If left empty, and a invoice_date is provided, this value will automatically be set to the value of the invoice_date.

In ISO 8601 format.

Example

Updating the invoice date

Request

PATCH /invoices/637377985 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
    "data": {
        "type": "invoice",
        "id": "637377985",
        "attributes": {
            "invoice_date": "2019-10-04T00:00:00+02:00"
        }
    }
}

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://api.ecurring.com/invoices/637377985"
    },
    "data": {
        "type": "invoice",
        "id": "637377985",
        "links": {
            "self": "https://api.ecurring.com/invoices/637377985"
        },
        "attributes": {
            "status": "draft",
            "reference": "DRAFT",
            "amount_excl": "10.00",
            "amount_incl": "12.10",
            "tax_amount": "2.10",
            "invoice_date": "2019-10-04T00:00:00+02:00",
            "transaction_date": "2019-10-10T00:00:00+02:00",
            "created_at": "2019-10-03T11:33:17+02:00",
            "updated_at": "2019-10-04T09:57:41+02:00"
        },
        "relationships": {
            "subscription": {
                "links": {
                    "related": "https://api.ecurring.com/invoices/637377985/subscription"
                },
                "data": {
                    "type": "subscription",
                    "id": "739578262"
                }
            },
            "customer": {
                "links": {
                    "related": "https://api.ecurring.com/invoices/637377985/customer"
                },
                "data": {
                    "type": "customer",
                    "id": "149526343"
                }
            },
            "invoice-lines": {
                "links": {
                    "related": "https://api.ecurring.com/invoices/637377985/lines"
                },
                "data": []
            },
            "transaction": {
                "data": {
                    "type": "transaction",
                    "id": "b91c9eb1-1331-476e-aed1-344ca19d229d"
                }
            }
        }
    }
}