> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.solvimon.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.solvimon.com/_mcp/server.

# Credit notes

A credit note is an official accounting document that reduces the amount a customer owes on an invoice after that invoice has been finalized: the inverse of an invoice, formally acknowledging that the customer should pay less or receive money back.

---

## Why this matters

When an invoice is `FINAL`, it cannot be changed anymore. Any correction, whether a billing mistake, a service credit, or a goodwill gesture, happens through a credit note: a new document linked to the original invoice, crediting it in full or in part. The original invoice remains `FINAL`; the credit note is created in `DRAFT`, carries a 'CR' prefix in its invoice number, and follows the normal [invoice lifecycle](/platform-guides/invoicing/invoices/invoice-lifecycle).

## Creating a credit note

### Via API

Create a credit note with [POST /v1/invoices/\{id}/credit](https://docs.solvimon.com/api-docs/transaction-api/invoices/post-invoices-by-resource-id-credit) on the invoice that needs to be credited. Do not specify any invoice lines to credit the entire invoice:

### Request

POST [https://test.api.solvimon.com/v\{version}/invoices/\{resourceId}/credit](https://test.api.solvimon.com/v\{version}/invoices/\{resourceId}/credit)

**`Credit an invoice in full`**

```curl Credit an invoice in full
curl -X POST https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit \
     -H "X-API-KEY: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "note": "Crediting the entire invoice"
}'
```

**`Credit an invoice in full`**

```python Credit an invoice in full
import requests

url = "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit"

payload = { "note": "Crediting the entire invoice" }
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`Credit an invoice in full`**

```javascript Credit an invoice in full
const url = 'https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"note":"Crediting the entire invoice"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Credit an invoice in full`**

```go Credit an invoice in full
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit"

	payload := strings.NewReader("{\n  \"note\": \"Crediting the entire invoice\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Credit an invoice in full`**

```ruby Credit an invoice in full
require 'uri'
require 'net/http'

url = URI("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"note\": \"Crediting the entire invoice\"\n}"

response = http.request(request)
puts response.read_body
```

**`Credit an invoice in full`**

```java Credit an invoice in full
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"note\": \"Crediting the entire invoice\"\n}")
  .asString();
```

**`Credit an invoice in full`**

```php Credit an invoice in full
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit', [
  'body' => '{
  "note": "Crediting the entire invoice"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`Credit an invoice in full`**

```csharp Credit an invoice in full
using RestSharp;

var client = new RestClient("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"note\": \"Crediting the entire invoice\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`Credit an invoice in full`**

```swift Credit an invoice in full
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["note": "Crediting the entire invoice"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

The response is the credit note, linked to the original invoice:

### Response (200)

```json
{
  "object_type": "INVOICE",
  "id": "invo_NxHlr3Cwd8vkK7XX3Sh6",
  "customer_id": "cust_AbD3DqausjOYiMNDZY11F",
  "status": "DRAFT",
  "type": "CREDIT",
  "created_at": "2026-07-02T09:15:00Z",
  "updated_at": "2026-07-02T09:15:00Z",
  "billing_currency": "EUR",
  "invoice_amount_including_tax": {
    "quantity": "-250.00",
    "currency": "EUR"
  },
  "payment_status": "UNPAID",
  "paid": false,
  "linked_invoices_ids": [
    "invo_MwGkq2Bvc7ujJ6YY2Rg5"
  ]
}
```

To credit an invoice partially, specify the periods, line groups, and per-line credit amounts in the `periods` field instead of leaving the request body empty:

### Request

POST [https://test.api.solvimon.com/v\{version}/invoices/\{resourceId}/credit](https://test.api.solvimon.com/v\{version}/invoices/\{resourceId}/credit)

**`Credit an invoice partially`**

```curl Credit an invoice partially
curl -X POST https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit \
     -H "X-API-KEY: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "note": "Crediting one incorrect line",
  "periods": [
    {
      "period_order": 0,
      "amount": {
        "quantity": "50.00",
        "currency": "EUR"
      },
      "groups": [
        {
          "group_order": 0,
          "amount": {
            "quantity": "50.00",
            "currency": "EUR"
          },
          "lines": [
            {
              "line_order": 2,
              "amount": {
                "quantity": "50.00",
                "currency": "EUR"
              }
            }
          ]
        }
      ]
    }
  ]
}'
```

**`Credit an invoice partially`**

```python Credit an invoice partially
import requests

url = "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit"

payload = {
    "note": "Crediting one incorrect line",
    "periods": [
        {
            "period_order": 0,
            "amount": {
                "quantity": "50.00",
                "currency": "EUR"
            },
            "groups": [
                {
                    "group_order": 0,
                    "amount": {
                        "quantity": "50.00",
                        "currency": "EUR"
                    },
                    "lines": [
                        {
                            "line_order": 2,
                            "amount": {
                                "quantity": "50.00",
                                "currency": "EUR"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`Credit an invoice partially`**

```javascript Credit an invoice partially
const url = 'https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"note":"Crediting one incorrect line","periods":[{"period_order":0,"amount":{"quantity":"50.00","currency":"EUR"},"groups":[{"group_order":0,"amount":{"quantity":"50.00","currency":"EUR"},"lines":[{"line_order":2,"amount":{"quantity":"50.00","currency":"EUR"}}]}]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Credit an invoice partially`**

```go Credit an invoice partially
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit"

	payload := strings.NewReader("{\n  \"note\": \"Crediting one incorrect line\",\n  \"periods\": [\n    {\n      \"period_order\": 0,\n      \"amount\": {\n        \"quantity\": \"50.00\",\n        \"currency\": \"EUR\"\n      },\n      \"groups\": [\n        {\n          \"group_order\": 0,\n          \"amount\": {\n            \"quantity\": \"50.00\",\n            \"currency\": \"EUR\"\n          },\n          \"lines\": [\n            {\n              \"line_order\": 2,\n              \"amount\": {\n                \"quantity\": \"50.00\",\n                \"currency\": \"EUR\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Credit an invoice partially`**

```ruby Credit an invoice partially
require 'uri'
require 'net/http'

url = URI("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"note\": \"Crediting one incorrect line\",\n  \"periods\": [\n    {\n      \"period_order\": 0,\n      \"amount\": {\n        \"quantity\": \"50.00\",\n        \"currency\": \"EUR\"\n      },\n      \"groups\": [\n        {\n          \"group_order\": 0,\n          \"amount\": {\n            \"quantity\": \"50.00\",\n            \"currency\": \"EUR\"\n          },\n          \"lines\": [\n            {\n              \"line_order\": 2,\n              \"amount\": {\n                \"quantity\": \"50.00\",\n                \"currency\": \"EUR\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

**`Credit an invoice partially`**

```java Credit an invoice partially
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"note\": \"Crediting one incorrect line\",\n  \"periods\": [\n    {\n      \"period_order\": 0,\n      \"amount\": {\n        \"quantity\": \"50.00\",\n        \"currency\": \"EUR\"\n      },\n      \"groups\": [\n        {\n          \"group_order\": 0,\n          \"amount\": {\n            \"quantity\": \"50.00\",\n            \"currency\": \"EUR\"\n          },\n          \"lines\": [\n            {\n              \"line_order\": 2,\n              \"amount\": {\n                \"quantity\": \"50.00\",\n                \"currency\": \"EUR\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}")
  .asString();
```

**`Credit an invoice partially`**

```php Credit an invoice partially
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit', [
  'body' => '{
  "note": "Crediting one incorrect line",
  "periods": [
    {
      "period_order": 0,
      "amount": {
        "quantity": "50.00",
        "currency": "EUR"
      },
      "groups": [
        {
          "group_order": 0,
          "amount": {
            "quantity": "50.00",
            "currency": "EUR"
          },
          "lines": [
            {
              "line_order": 2,
              "amount": {
                "quantity": "50.00",
                "currency": "EUR"
              }
            }
          ]
        }
      ]
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`Credit an invoice partially`**

```csharp Credit an invoice partially
using RestSharp;

var client = new RestClient("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"note\": \"Crediting one incorrect line\",\n  \"periods\": [\n    {\n      \"period_order\": 0,\n      \"amount\": {\n        \"quantity\": \"50.00\",\n        \"currency\": \"EUR\"\n      },\n      \"groups\": [\n        {\n          \"group_order\": 0,\n          \"amount\": {\n            \"quantity\": \"50.00\",\n            \"currency\": \"EUR\"\n          },\n          \"lines\": [\n            {\n              \"line_order\": 2,\n              \"amount\": {\n                \"quantity\": \"50.00\",\n                \"currency\": \"EUR\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`Credit an invoice partially`**

```swift Credit an invoice partially
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "note": "Crediting one incorrect line",
  "periods": [
    [
      "period_order": 0,
      "amount": [
        "quantity": "50.00",
        "currency": "EUR"
      ],
      "groups": [
        [
          "group_order": 0,
          "amount": [
            "quantity": "50.00",
            "currency": "EUR"
          ],
          "lines": [
            [
              "line_order": 2,
              "amount": [
                "quantity": "50.00",
                "currency": "EUR"
              ]
            ]
          ]
        ]
      ]
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

The response includes the credit note's invoice number, once it moves to `Final`.

### Via Desk

* Go to the invoice you'd like to credit
* In the menu, select 'Credit entire invoice'

  ![](/_fern-img/bd6158c7b65e073c2da840703e630967522130e002926f02b08dd4503640f289.webp)
* Add an optional note and create the credit note

  ![](/_fern-img/1bf83ea194547906522e8c6b41545bc0455d80dba987355d6a9a02323c92bff3.webp)
* You are navigated to the credit note, where the PDF can be downloaded. The original invoice is linked to the credit note as shown below

  ![](/_fern-img/e68f6275b2288a0390406f278a15ea5cb8e1a3041f8ecc3f473aff8f751620a2.webp)
* The credit note is also linked in the main invoice

  ![](/_fern-img/6553bb41b59f310aeb044dc37c2014df109129f20773336fbb0849f5ddf6824f.webp)

## Customer details on the credit note

By default Solvimon refreshes the customer and billing details on a draft invoice with the **current** values, which means a credit note can end up with details that differ from the invoice it is crediting.

For example:

* The original `FINAL` invoice was issued to `Daalsesingel 51`.
* The customer's address is later changed to `Daalsesingel 52`.
* By default, the credit note would show the **new** address (`52`), not the address on the original invoice.

The `credit_details_source` option on the credit action lets you choose which behaviour you want:

| Value      | Behaviour                                                                                                                                                                                                            |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CURRENT`  | **Default.** Refresh the customer and billing entity when creating the credit note, so it reflects the most up-to-date information. Matches the previous behaviour.                                                  |
| `ORIGINAL` | Copy the customer and billing entity **exactly** from the original invoice, without refreshing. Use this when the credit note must mirror the invoice it credits, even if the customer's details have since changed. |

### Request

POST [https://test.api.solvimon.com/v\{version}/invoices/\{resourceId}/credit](https://test.api.solvimon.com/v\{version}/invoices/\{resourceId}/credit)

**`Credit an invoice with original details`**

```curl Credit an invoice with original details
curl -X POST https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit \
     -H "X-API-KEY: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "note": "Crediting due to incorrect billing address",
  "credit_details_source": "ORIGINAL"
}'
```

**`Credit an invoice with original details`**

```python Credit an invoice with original details
import requests

url = "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit"

payload = {
    "note": "Crediting due to incorrect billing address",
    "credit_details_source": "ORIGINAL"
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`Credit an invoice with original details`**

```javascript Credit an invoice with original details
const url = 'https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"note":"Crediting due to incorrect billing address","credit_details_source":"ORIGINAL"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Credit an invoice with original details`**

```go Credit an invoice with original details
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit"

	payload := strings.NewReader("{\n  \"note\": \"Crediting due to incorrect billing address\",\n  \"credit_details_source\": \"ORIGINAL\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Credit an invoice with original details`**

```ruby Credit an invoice with original details
require 'uri'
require 'net/http'

url = URI("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"note\": \"Crediting due to incorrect billing address\",\n  \"credit_details_source\": \"ORIGINAL\"\n}"

response = http.request(request)
puts response.read_body
```

**`Credit an invoice with original details`**

```java Credit an invoice with original details
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"note\": \"Crediting due to incorrect billing address\",\n  \"credit_details_source\": \"ORIGINAL\"\n}")
  .asString();
```

**`Credit an invoice with original details`**

```php Credit an invoice with original details
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit', [
  'body' => '{
  "note": "Crediting due to incorrect billing address",
  "credit_details_source": "ORIGINAL"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`Credit an invoice with original details`**

```csharp Credit an invoice with original details
using RestSharp;

var client = new RestClient("https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"note\": \"Crediting due to incorrect billing address\",\n  \"credit_details_source\": \"ORIGINAL\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`Credit an invoice with original details`**

```swift Credit an invoice with original details
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "note": "Crediting due to incorrect billing address",
  "credit_details_source": "ORIGINAL"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://test.api.solvimon.com/v1/invoices/invo_MwGkq2Bvc7ujJ6YY2Rg5/credit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

> **Info**
>
> `credit_details_source` defaults to `CURRENT`, so existing integrations keep their current behaviour. Only set `ORIGINAL` when you explicitly want the credit note to copy the original invoice's details.

## Credit and reissue in one call

For the common correction scenario where a finalized invoice had the wrong details and you want to credit it and reissue a fixed version in one step, use [POST /v1/invoices/\{id}/credit\_and\_copy](https://docs.solvimon.com/api-docs/transaction-api/invoices/post-invoices-by-resource-id-credit-and-copy). It creates the credit note and a corrected copy of the invoice in a single call, and accepts the same `credit_details_source` option.

The same flow is available in Desk: the credit action on an invoice can credit it and create a duplicate in one step. The credit note cancels the original, and the duplicate gives you an editable draft to fix and re-send.

---

See also: [Correcting invoices](/platform-guides/invoicing/invoice-corrections), [Referenced refunds](/platform-guides/invoicing/invoice-corrections/referenced-refunds-on-credited-invoices) and [Invoice lifecycle](/platform-guides/invoicing/invoices/invoice-lifecycle).