Credit invoice

POST https://api.ecurring.com/invoices/{id}/credit

Credit an invoice. This creates a draft invoice equal to the invoice you provided the {id} for. This newly created draft also has the same invoice lines, but the amounts are inverted. So if there was an invoice line with an amount of 20.00, the invoice line on the draft will have an amount of -20.00.

Parameters

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

Example

Request

PATCH /invoices/637377985/credit HTTP/1.1
Accept: application/vnd.api+json

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
    "links": {
        "self": "https://api.ecurring.com/invoices/278193007"
    },
    "data": {
        "type": "invoice",
        "id": "278193007",
        "links": {
            "self": "https://api.ecurring.com/invoices/278193007"
        },
        "attributes": {
            "status": "draft",
            "reference": "DRAFT",
            "amount_excl": "-993.10",
            "amount_incl": "-1104.72",
            "tax_rates": [
                {
                    "amount": "-59.90",
                    "rate": "21.00"
                },
                {
                    "amount": "-36.72",
                    "rate": "9.00"
                },
                {
                    "amount": "-15.00",
                    "rate": "5.00"
                }
            ],
            "tax_amount": "-111.62",
            "invoice_date": null,
            "transaction_date": null,
            "hosted_invoice_url": "https://billing.ecurring.com/invoice/323a241a61ab4339c416fadf8f816e57?lang=nl",
            "created_at": "2020-04-15T16:35:26+02:00",
            "updated_at": "2020-04-15T16:35:26+02:00"
        },
        "relationships": {
            "subscription": {
                "links": {
                    "related": "https://api.ecurring.com/invoices/278193007/subscription"
                },
                "data": {
                    "type": "subscription",
                    "id": "739578262"
                }
            },
            "customer": {
                "links": {
                    "related": "https://api.ecurring.com/invoices/278193007/customer"
                },
                "data": {
                    "type": "customer",
                    "id": "149526343"
                }
            },
            "invoice-lines": {
                "links": {
                    "related": "https://api.ecurring.com/invoices/278193007/lines"
                },
                "data": [
                    {
                        "type": "invoice-line",
                        "id": "847442567"
                    },
                    {
                        "type": "invoice-line",
                        "id": "1803390100"
                    },
                    {
                        "type": "invoice-line",
                        "id": "1077716709"
                    }
                ]
            },
            "transaction": {
                "data": null
            },
            "original-invoice": {
                "data": {
                    "type": "invoice",
                    "id": "637377985"
                }
            }
        }
    }
}