# Resend failed einvoice in invoices

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


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

Resend failed einvoice of an invoice to the customer using this API.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/invoices/__demo_inv__1/resend_einvoice \
     -X POST  \
     -u {site_api_key}:
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Invoice.ResendEinvoice("__demo_inv__1").Request();

Invoice invoice = result.Invoice;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    invoiceAction "github.com/chargebee/chargebee-go/v3/actions/invoice"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := invoiceAction.ResendEinvoice("__demo_inv__1").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Invoice := res.Invoice
    }
}
```

#### 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.InvoiceResendEinvoiceRequest{
    Id : "__demo_inv__1",
}
  res, err := client.Invoice.ResendEinvoice(req)
      if err != nil {
        fmt.Println(err)
    } else {
        Invoice := res.Invoice
    }
}
```

#### 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 = Invoice.resendEinvoice("__demo_inv__1").request();

        Invoice invoice = result.invoice();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.invoice.Invoice;
import com.chargebee.v4.models.invoice.params.ResendEinvoiceParams;
import com.chargebee.v4.models.invoice.responses.ResendEinvoiceResponse;

public class ResendEinvoice {

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

        ResendEinvoiceResponse response = client.invoices().resendEinvoice("__demo_inv__1");

        Invoice invoice = response.getInvoice();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.invoice.resendEinvoice("__demo_inv__1");

    console.log(result);
    const invoice = result.invoice;
} 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->invoice()->resendEinvoice("__demo_inv__1");
$invoice = $result->invoice;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Invoice.resend_einvoice("__demo_inv__1")
invoice = response.invoice
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Invoice.resend_einvoice("__demo_inv__1")

invoice = result.invoice
```

## Sample Response

```json
{
  "invoice": {
    "id": "__demo_inv__1",
    "customer_id": "customer",
    "recurring": false,
    "status": "paid",
    "vat_number": "812526315",
    "price_type": "tax_exclusive",
    "date": 1619600068,
    "due_date": 1619600068,
    "net_term_days": 0,
    "exchange_rate": 1,
    "total": 1190,
    "amount_paid": 1190,
    "amount_adjusted": 0,
    "write_off_amount": 0,
    "credits_applied": 0,
    "amount_due": 0,
    "paid_at": 1619600068,
    "updated_at": 1619600076,
    "resource_version": 1619600076416,
    "deleted": false,
    "object": "invoice",
    "first_invoice": false,
    "amount_to_collect": 0,
    "round_off_amount": 0,
    "has_advance_charges": false,
    "currency_code": "USD",
    "base_currency_code": "USD",
    "generated_at": 1619600068,
    "is_gifted": false,
    "term_finalized": true,
    "channel": "web",
    "is_digital": true,
    "einvoice": {
      "id": "HmaT0avT2mtbTL3mR",
      "status": "scheduled",
      "message": "E-invoice sending is scheduled and not yet processed.",
      "object": "einvoice"
    },
    "tax": 190,
    "line_items": [
      {
        "id": "li_HmaT0avT2mtbMt3mD",
        "date_from": 1649356200,
        "date_to": 1649529000,
        "unit_amount": 1000,
        "quantity": 1,
        "amount": 1000,
        "pricing_model": "flat_fee",
        "is_taxed": true,
        "tax_amount": 190,
        "tax_rate": 19,
        "object": "line_item",
        "customer_id": "customer",
        "description": "none",
        "entity_type": "adhoc",
        "metered": false,
        "discount_amount": 0,
        "item_level_discount_amount": 0
      },
      {..}
    ],
    "taxes": [
      {
        "object": "tax",
        "name": "VAT",
        "description": "VAT @ 19%",
        "amount": 190
      },
      {..}
    ],
    "line_item_taxes": [
      {
        "tax_name": "VAT",
        "tax_rate": 19,
        "tax_juris_type": "country",
        "tax_juris_name": "Germany",
        "tax_juris_code": "DE",
        "object": "line_item_tax",
        "line_item_id": "li_HmaT0avT2mtbMt3mD",
        "tax_amount": 190,
        "is_partial_tax_applied": false,
        "taxable_amount": 1000,
        "is_non_compliance_tax": false
      },
      {..}
    ],
    "sub_total": 1000,
    "linked_payments": [
      {
        "txn_id": "txn_HmaT0avT2mtbQ93mJ",
        "applied_amount": 1190,
        "applied_at": 1619600068,
        "txn_status": "success",
        "txn_date": 1619600068,
        "txn_amount": 1190
      },
      {..}
    ],
    "applied_credits": {},
    "adjustment_credit_notes": {},
    "issued_credit_notes": {},
    "linked_orders": {},
    "dunning_attempts": {},
    "billing_address": {
      "country": "DE",
      "validation_status": "not_validated",
      "object": "billing_address"
    }
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/invoices/{invoice-id}/resend_einvoice

## Returns

- `invoice` (Invoice object)
  Resource object representing invoice
