# Credit note allocation

Invoices sent to the interface cannot be canceled or changed. If there is an error in the&#x20;invoice or if the invoice is to be canceled, a counterparty credit note will be sent to the&#x20;interface that will partially or completely cancel the original invoice.

\
The credit note is like the normal invoice, but on invoice rows the amounts are&#x20;presented negative and a refund jobid or refundtobillnum tag is added to the invoice,&#x20;indicating the initial invoice item or bill number to which the refund applies. If the credit&#x20;balance does not previously apply to the invoice sent to the Ropo One™, leave the&#x20;refund jobid and the refund without a billnum tag: you can always place a credit note&#x20;later in Ropo One™ if necessary. <br>

Please note! If you are using payrows netamount, vatamount and totalamount they\
have to be presented in negative.

An example, sending and ordinary invoice:&#x20;

<pre class="language-json"><code class="lang-json">JSON:
{
    "datastream": {
        "dataset": [
            {
                "jobtype": "0",
                "person": "Nelli Niirulainen",
                "address": "Kellokoskenkatu 15 A 3",
                "postcode": "70100",
                "city": "KUOPIO",
                "customertype": "2",
                "billdate": "2017-03-04",
                "paydate": "2017-03-18",
                "payrow": [
                    {
                        "desc": "Siivous",
                        "count": "1",
                        "itemtype": "h",
                        "amount": "100",
                        "taxpr": "23"
                    }
<strong>                ]
</strong>            }
        ]
    }
}
</code></pre>

And then crediting the invoice:

<pre class="language-json"><code class="lang-json">JSON:
{
    "datastream": {
        "dataset": [
            {
<strong>                "jobtype": "0",
</strong>                "refundtojobid": "549220",
                "person": "Nelli Niirulainen",
                "address": "Kellokoskenkatu 15 A 3",
                "postcode": "70100",
                "city": "KUOPIO",
                "customertype": "2",
                "billdate": "2017-03-04",
                "paydate": "2017-03-18",
                "payrow": [
                    {
                        "desc": "Siivous",
                        "count": "-1",
                        "itemtype": "h",
                        "amount": "100",
                        "taxpr": "23"
                    }
                ]
            }
        ]
<strong>    }
</strong>}
</code></pre>

The previous example credits the original invoice in full. If the invoice is only partially&#x20;credited, credits note’s invoice rows may be changed accordingly. For example, a 50%&#x20;credit can be achieved with a discount tag:

<pre class="language-json"><code class="lang-json">JSON:
<strong>"payrow": [
</strong>    {
        "desc": "Siivous",
        "count": "-1",
        "itemtype": "h",
        "amount": "100",
        "discount": "50",
        "taxpr": "23"
    }
]
</code></pre>

In credit invoices you can remove invoice rows or change the number of products&#x20;(pieces) as needed. Note, however, that no new products can be added to the credit&#x20;note: if the debtor has been sold after the original invoice has been sent, these must&#x20;be invoiced by a separate invoice!

## POST /jobs/creditnote

> Add credit note to existing job

```json
{"openapi":"3.1.0","info":{"title":"Ropo One","version":"1.0.0"},"tags":[{"name":"jobs","description":"Manage Jobs"}],"servers":[{"url":"/rest","description":"Ropo One"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","bearerFormat":"JWT","scheme":"bearer"}},"schemas":{"JobAddCreditNote":{"title":"JobAddCreditNote","description":"JobAddCreditNote","required":["amount","date"],"properties":{"amount":{"description":"Amount of credit note","type":"number"},"billcode":{"description":"Reference of job. One of these required: 1.billcode, 2.jobid, 3. billnum (search order)","type":"string"},"billnum":{"description":"Billnum of job. One of these required: 1.billcode, 2.jobid, 3. billnum (search order)","type":"string"},"jobid":{"description":"Id of job. One of these required: 1.billcode, 2.jobid, 3. billnum (search order)","type":"integer"},"date":{"description":"Date","type":"string"},"type":{"description":"Credit note type","type":"string"},"creditnotebillnum":{"description":"Credit note invoice number","type":"string"},"description":{"description":"Description of credit note","type":"string"}},"type":"object"},"JobAddCreditNoteResponse":{"title":"JobAddCreditNoteResponse","description":"JobAddCreditNoteResponse","properties":{"jobid":{"description":"Id of job","type":"integer"},"billnum":{"description":"Billnum of job","type":"string"},"billcode":{"description":"Reference of job","type":"string"},"date":{"description":"Date of credit note","type":"string"},"amount":{"description":"Amount of credit note","type":"number"},"statusid":{"description":"0 : UNDONE, 1 : FAIL, 2 : OLD, 8 : IGNORE, 10 : NOT FOUND, 11 : CANCELLED, 12 = OLD CANCEL.","type":"number"},"statustext":{"description":"additional information","type":"number"}},"type":"object"}}},"paths":{"/jobs/creditnote":{"post":{"tags":["jobs"],"summary":"Add credit note to existing job","operationId":"JobAddCreditNoteJobAction","requestBody":{"description":"JobAddCreditNote","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobAddCreditNote"}}}},"responses":{"201":{"description":"Credit note response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobAddCreditNoteResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobAddCreditNoteResponse"}}}},"401":{"description":"Unauthorized"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ropo.com/guides/basics/credit-note-allocation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
