# Remove tax withheld refunds from a credit note

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

Removes a `[linked_tax_withheld_refunds](/docs/api/credit_notes/credit_note-object#linked_tax_withheld_refunds)` record from the `credit_note` .

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/credit_notes/__demo_cn__1/remove_tax_withheld_refund \
     -u {site_api_key}:\
     -d "tax_withheld[id]"="tax_wh___test__8astRSmw2zLr24"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = CreditNote.RemoveTaxWithheldRefund("__demo_cn__1")
		.TaxWithheldId("tax_wh___test__8astRSmw2zLr24")
		.Request();

CreditNote creditNote = result.CreditNote;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    creditnoteAction "github.com/chargebee/chargebee-go/v3/actions/creditnote"
    "github.com/chargebee/chargebee-go/v3/models/creditnote"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := creditnoteAction.RemoveTaxWithheldRefund("__demo_cn__1", &creditnote.RemoveTaxWithheldRefundRequestParams{
        TaxWithheld : &creditnote.RemoveTaxWithheldRefundTaxWithheldParams{
            Id : "tax_wh___test__8astRSmw2zLr24",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        CreditNote := res.CreditNote
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.CreditNoteRemoveTaxWithheldRefundRequest{
    TaxWithheld : &chargebee.CreditNoteRemoveTaxWithheldRefundTaxWithheld{
        Id : "tax_wh___test__8astRSmw2zLr24",
    },
}
  res, err := client.CreditNote.RemoveTaxWithheldRefund("__demo_cn__1", req)
      if err != nil {
        fmt.Println(err)
    } else {
        CreditNote := res.CreditNote
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = CreditNote.removeTaxWithheldRefund("__demo_cn__1")
            .taxWithheldId("tax_wh___test__8astRSmw2zLr24")
            .request();

        CreditNote creditNote = result.creditNote();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.creditNote.CreditNote;
import com.chargebee.v4.models.creditNote.params.CreditNoteRemoveTaxWithheldRefundParams;
import com.chargebee.v4.models.creditNote.responses.CreditNoteRemoveTaxWithheldRefundResponse;

public class CreditNoteRemoveTaxWithheldRefund {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        CreditNoteRemoveTaxWithheldRefundParams.TaxWithheldParams taxWithheldParams =
            CreditNoteRemoveTaxWithheldRefundParams.TaxWithheldParams.builder()
                .id("tax_wh___test__8astRSmw2zLr24")
                .build();

        CreditNoteRemoveTaxWithheldRefundParams params = CreditNoteRemoveTaxWithheldRefundParams.builder()
            .taxWithheld(taxWithheldParams)
            .build();

        CreditNoteRemoveTaxWithheldRefundResponse response = client
            .creditNotes()
            .removeTaxWithheldRefund("__demo_cn__1", params);

        CreditNote creditNote = response.getCreditNote();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.creditNote.removeTaxWithheldRefund("__demo_cn__1", {
        tax_withheld: {
            id: "tax_wh___test__8astRSmw2zLr24"
        }
    });

    console.log(result);
    const creditNote = result.credit_note;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->creditNote()->removeTaxWithheldRefund("__demo_cn__1", [
    "tax_withheld" => [
        "id" => "tax_wh___test__8astRSmw2zLr24"
    ]
]);
$creditNote = $result->credit_note;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.CreditNote.remove_tax_withheld_refund("__demo_cn__1",
    cb_client.CreditNote.RemoveTaxWithheldRefundParams(
        tax_withheld=cb_client.CreditNote.RemoveTaxWithheldRefundTaxWithheldParams(
            id="tax_wh___test__8astRSmw2zLr24"
        )
    )
)
credit_note = response.credit_note
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::CreditNote.remove_tax_withheld_refund("__demo_cn__1",{
  :tax_withheld => {
    :id => "tax_wh___test__8astRSmw2zLr24"
  }
})

credit_note = result.credit_note
```

## Sample Response

```json
{
  "credit_note": {
    "allocations": {},
    "amount_allocated": 0,
    "amount_available": 200,
    "amount_refunded": 800,
    "base_currency_code": "USD",
    "channel": "web",
    "create_reason_code": "Other",
    "currency_code": "USD",
    "customer_id": "__test__8astRSmw2z1q1j",
    "date": 1517475512,
    "deleted": false,
    "exchange_rate": 1,
    "fractional_correction": 0,
    "generated_at": 1517475512,
    "id": "__demo_cn__1",
    "line_item_discounts": {},
    "line_item_taxes": {},
    "line_items": [
      {
        "amount": 1000,
        "customer_id": "__test__8astRSmw2z1q1j",
        "date_from": 1517475512,
        "date_to": 1517475512,
        "description": "Support Charge",
        "discount_amount": 0,
        "entity_type": "adhoc",
        "id": "li___test__8astRSmw2zMR26",
        "is_taxed": false,
        "item_level_discount_amount": 0,
        "object": "line_item",
        "pricing_model": "flat_fee",
        "quantity": 1,
        "tax_amount": 0,
        "tax_exempt_reason": "tax_not_configured",
        "unit_amount": 1000
      },
      {..}
    ],
    "linked_refunds": [
      {
        "applied_amount": 800,
        "applied_at": 1517475512,
        "txn_amount": 800,
        "txn_date": 1517475512,
        "txn_id": "txn___test__8astRSmw2zLp23",
        "txn_status": "success"
      },
      {..}
    ],
    "object": "credit_note",
    "price_type": "tax_exclusive",
    "reason_code": "other",
    "reference_invoice_id": "__demo_inv__1",
    "resource_version": 1517475512664,
    "round_off_amount": 0,
    "status": "refund_due",
    "sub_total": 1000,
    "taxes": {},
    "total": 1000,
    "type": "refundable",
    "updated_at": 1517475512
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/credit_notes/{credit-note-id}/remove_tax_withheld_refund

## Input Parameters

- `tax_withheld` (optional, string)
  Parameters for tax\_withheld
  - `id` (required, string, max chars=40)
    An auto-generated unique identifier for the tax withheld. The value starts with the prefix `tax_wh_`. For example, `tax_wh_16BdDXSlbu4uV1Ee6` .

## Returns

- `credit_note` (Credit note object)
  Resource object representing credit\_note
