# PostCreditNotes

From **Stripe API**.

`POST /v1/credit_notes`

<p>Issue a credit note to adjust the amount of a finalized invoice. For a <code>status=open</code> invoice, a credit note reduces
its <code>amount_due</code>. For a <code>status=paid</code> invoice, a credit note does not affect its <code>amount_due</code>. Instead, it can result
in any combination of the following:</p>

<ul>
<li>Refund: create a new refund (using <code>refund_amount</code>) or link an existing refund (using <code>refund</code>).</li>
<li>Customer balance credit: credit the customer’s balance (using <code>credit_amount</code>) which will be automatically applied to their next invoice when it’s finalized.</li>
<li>Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using <code>out_of_band_amount</code>).</li>
</ul>

<p>For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.</p>

<p>You may issue multiple credit notes for an invoice. Each credit note will increment the invoice’s <code>pre_payment_credit_notes_amount</code>
or <code>post_payment_credit_notes_amount</code> depending on its <code>status</code> at the time of credit note creation.</p>

## Request body

- Required: true
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"amount":{"description":"The integer amount in %s representing the total amount of the credit note.","type":"integer"},"credit_amount":{"description":"The integer amount in %s representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.","type":"integer"},"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"invoice":{"description":"ID of the invoice.","maxLength":5000,"type":"string"},"lines":{"description":"Line items that make up the credit note.","items":{"properties":{"amount":{"type":"integer"},"description":{"maxLength":5000,"type":"string"},"invoice_line_item":{"maxLength":5000,"type":"string"},"quantity":{"type":"integer"},"tax_rates":{"anyOf":[{"items":{"maxLength":5000,"type":"string"},"type":"array"},{"enum":[""],"type":"string"}]},"type":{"enum":["custom_line_item","invoice_line_item"],"type":"string"},"unit_amount":{"type":"integer"},"unit_amount_decimal":{"format":"decimal","type":"string"}},"required":["type"],"title":"credit_note_line_item_params","type":"object"},"type":"array"},"memo":{"description":"The credit note's memo appears on the credit note PDF.","maxLength":5000,"type":"string"},"metadata":{"additionalProperties":{"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.","type":"object"},"out_of_band_amount":{"description":"The integer amount in %s representing the amount that is credited outside of Stripe.","type":"integer"},"reason":{"description":"Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`","enum":["duplicate","fraudulent","order_change","product_unsatisfactory"],"type":"string"},"refund":{"description":"ID of an existing refund to link this credit note to.","type":"string"},"refund_amount":{"description":"The integer amount in %s representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.","type":"integer"}},"required":["invoice"],"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

Issue a credit note to adjust an invoice's amount after the invoice is finalized.

Related guide: [Credit Notes](https://stripe.com/docs/billing/invoices/credit-notes).

```json
{"description":"Issue a credit note to adjust an invoice's amount after the invoice is finalized.\n\nRelated guide: [Credit Notes](https://stripe.com/docs/billing/invoices/credit-notes).","properties":{"amount":{"description":"The integer amount in %s representing the total amount of the credit note, including tax.","type":"integer"},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"currency":{"description":"Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).","type":"string"},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}],"description":"ID of the customer.","x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}]}},"customer_balance_transaction":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer_balance_transaction"}],"description":"Customer balance transaction related to this credit note.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer_balance_transaction"}]}},"discount_amount":{"description":"The integer amount in %s representing the total amount of discount that was credited.","type":"integer"},"discount_amounts":{"description":"The aggregate amounts calculated per discount for all line items.","items":{"$ref":"#/components/schemas/discounts_resource_discount_amount"},"type":"array"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"invoice":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/invoice"}],"description":"ID of the invoice.","x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/invoice"}]}},"lines":{"description":"Line items that make up the credit note","properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/credit_note_line_item"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"CreditNoteLinesList","type":"object","x-expandableFields":["data"]},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"memo":{"description":"Customer-facing text that appears on the credit note PDF.","maxLength":5000,"nullable":true,"type":"string"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","nullable":true,"type":"object"},"number":{"description":"A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.","maxLength":5000,"type":"string"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["credit_note"],"type":"string"},"out_of_band_amount":{"description":"Amount that was credited outside of Stripe.","nullable":true,"type":"integer"},"pdf":{"description":"The link to download the PDF of the credit note.","maxLength":5000,"type":"string"},"reason":{"description":"Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`","enum":["duplicate","fraudulent","order_change","product_unsatisfactory"],"nullable":true,"type":"string"},"refund":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/refund"}],"description":"Refund related to this credit note.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/refund"}]}},"status":{"description":"Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).","enum":["issued","void"],"type":"string"},"subtotal":{"description":"The integer amount in %s representing the amount of the credit note, excluding tax and invoice level discounts.","type":"integer"},"tax_amounts":{"description":"The aggregate amounts calculated per tax rate for all line items.","items":{"$ref":"#/components/schemas/credit_note_tax_amount"},"type":"array"},"total":{"description":"The integer amount in %s representing the total amount of the credit note, including tax and all discount.","type":"integer"},"type":{"description":"Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid.","enum":["post_payment","pre_payment"],"type":"string"},"voided_at":{"description":"The time that the credit note was voided.","format":"unix-time","nullable":true,"type":"integer"}},"required":["amount","created","currency","customer","discount_amount","discount_amounts","id","invoice","lines","livemode","number","object","pdf","status","subtotal","tax_amounts","total","type"],"title":"CreditNote","type":"object","x-expandableFields":["customer","customer_balance_transaction","discount_amounts","invoice","lines","refund","tax_amounts"],"x-resourceId":"credit_note"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/credit_notes \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "amount": 1,
  "credit_amount": 1,
  "expand": [
    "string"
  ],
  "invoice": "string",
  "lines": [
    {
      "amount": 1,
      "description": "string",
      "invoice_line_item": "string",
      "quantity": 1,
      "tax_rates": "string",
      "type": "string",
      "unit_amount": 1,
      "unit_amount_decimal": "string"
    }
  ],
  "memo": "string",
  "metadata": {},
  "out_of_band_amount": 1,
  "reason": "string",
  "refund": "string",
  "refund_amount": 1
}'
```
