# Corporate Invoice

The Corporate Invoice resource is used to add funds to your Corporate balance.

Create a Corporate Invoice to receive a Pix BR Code that you can pay from an account you hold in any bank. Once the Corporate Invoice is paid, the funds land in your Corporate balance and become available for card spending.

The payer name and tax ID are always taken from your Workspace owner, so you only need to inform the amount you want to load.

### The Corporate Invoice object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `amount` | INTEGER | Corporate Invoice value in cents. Example: 1234 (R$12.34). |
| `brcode` | STRING | BR Code for the Corporate Invoice Pix payment. |
| `corporateTransactionId` | STRING | Id of the Corporate Transaction created when the Corporate Invoice is paid. Empty while the Corporate Invoice has not been paid. |
| `created` | STRING | Creation datetime. Example: "2023-05-10T17:10:57.261868+00:00". |
| `due` | STRING | Corporate Invoice due and expiration datetime. Example: "2023-05-17T17:10:57.261868+00:00". |
| `id` | STRING | Unique id for the Corporate Invoice. |
| `link` | STRING | Public URL to the Corporate Invoice payment page. |
| `name` | STRING | Payer full name, taken from your Workspace owner. Example: "Iron Bank S.A.". |
| `status` | STRING | Current Corporate Invoice status. Options: "created", "expired", "overdue", "paid". |
| `tags` | LIST OF STRINGS | Tags associated with the Corporate Invoice. All tags are returned in lowercase. |
| `taxId` | STRING | Payer CPF or CNPJ, taken from your Workspace owner. Example: "20.018.183/0001-80". |
| `updated` | STRING | Last update datetime. Example: "2023-05-10T17:10:57.261877+00:00". |

### Create a Corporate Invoice

`POST /v2/corporate-invoice`

Use this route to create a new Corporate Invoice and receive the BR Code you should pay to load your Corporate balance.

**NOTE:**The payer name and tax ID are always filled in with your Workspace owner's data, so they cannot be sent in the request. The Corporate Invoice is due 7 days after creation and cannot be paid after that.

**NOTE:**You cannot create a Corporate Invoice while your Workspace has a pending or overdue Corporate Billing Invoice.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `amount` | REQUIRED | A positive integer that represents the amount in cents to be loaded into your Corporate balance. Example: 10000 (R$100.00) |
| `tags` | OPTIONAL | Array of up to 100 strings to tag the entity for future queries. Each tag can have up to 100 characters and all tags will be converted to lowercase. Example: ["travel", "food"] |

**Request**

```python
import starkbank

invoice = starkbank.corporateinvoice.create(
    invoice=starkbank.CorporateInvoice(
        amount=10000,
        tags=["travel", "food"]
    )
)

print(invoice)
```

**Response**

```python
CorporateInvoice(
    amount=10000,
    brcode=00020101021226930014br.gov.bcb.pix2571brcode-h.sandbox.starkbank.com/v2/d7f6546e194d4c64a153e8f79f1c41ac5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63042109,
    corporate_transaction_id=,
    created=2023-05-10 17:10:57.261868+00:00,
    due=2023-05-17 17:10:57.261868+00:00,
    id=5656565656565656,
    link=https://starkbank-card-issuer.sandbox.starkbank.com/invoicelink/d7f6546e194d4c64a153e8f79f1c41ac,
    name=Iron Bank S.A.,
    status=created,
    tags=['travel', 'food'],
    tax_id=20.018.183/0001-80,
    updated=2023-05-10 17:10:57.261877+00:00
)
```

### List Corporate Invoices

`GET /v2/corporate-invoice`

Get a list of Corporate Invoices in chunks of at most 100. If you need smaller chunks, use the limit parameter.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. Default value = 100. |
| `status` | OPTIONAL | Filter Corporate Invoices by the specified status. Options: "created", "expired", "overdue", "paid". |
| `tags` | OPTIONAL | Filter entities that contain the specified tags. |

**Request**

```python
import starkbank

invoices = starkbank.corporateinvoice.query(
    after="2023-05-01",
    before="2023-05-30",
    limit=10
)

for invoice in invoices:
    print(invoice)
```

**Response**

```python
CorporateInvoice(
    amount=10000,
    brcode=00020101021226930014br.gov.bcb.pix2571brcode-h.sandbox.starkbank.com/v2/d7f6546e194d4c64a153e8f79f1c41ac5204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63042109,
    corporate_transaction_id=6341320293482496,
    created=2023-05-10 17:10:57.261868+00:00,
    due=2023-05-17 17:10:57.261868+00:00,
    id=5656565656565656,
    link=https://starkbank-card-issuer.sandbox.starkbank.com/invoicelink/d7f6546e194d4c64a153e8f79f1c41ac,
    name=Iron Bank S.A.,
    status=paid,
    tags=['travel', 'food'],
    tax_id=20.018.183/0001-80,
    updated=2023-05-11 09:22:14.113450+00:00
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkbank.com/api/v2/corporate-invoice-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/corporate-invoice-node.md)
- [PHP](https://docs.starkbank.com/api/v2/corporate-invoice-php.md)
- [Java](https://docs.starkbank.com/api/v2/corporate-invoice-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/corporate-invoice-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/corporate-invoice-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/corporate-invoice-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/corporate-invoice-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/corporate-invoice-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/corporate-invoice-curl.md)
