# Tax Payment

Here we will explain how to create and manage tax payments, such as ISS and DAS.

### The Tax Payment object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the tax payment. |
| `amount` | INTEGER | Payment amount in cents. |
| `barCode` | STRING | Bar code number that describes the payment. |
| `created` | STRING | Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00". |
| `description` | STRING | Text displayed in the bank statement. |
| `fee` | INTEGER | Fee charged in cents. |
| `line` | STRING | Number sequence that describes the payment. |
| `scheduled` | STRING | Scheduled payment date. Example: "2020-04-23". |
| `status` | STRING | Current payment status. Options: "created", "processing", "confirmed", "success", "failed", "canceled". |
| `tags` | LIST OF STRINGS | Tags associated with the tax payment. |
| `transactionIds` | LIST OF STRINGS | Ledger transaction IDs linked to the payment. |
| `type` | STRING | Type of the tax payment. |
| `updated` | STRING | Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00". |

### Create Tax Payments

`POST /v2/tax-payment`

Use this route to pay taxes using the available balance in your Stark Bank account.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `description` | REQUIRED | Text to be displayed in your statement. Min length = 10. |
| `barCode` | CONDITIONALLY REQUIRED | Bar code number that describes the payment. Either "line" or "barCode" parameters are required. If both are sent, they must match. |
| `line` | CONDITIONALLY REQUIRED | Number sequence that describes the payment. Either "line" or "barCode" parameters are required. If both are sent, they must match. |
| `scheduled` | OPTIONAL | Schedule the payment for a specific date. Default value is the current day. |
| `tags` | OPTIONAL | Array of strings to tag the entity for future queries. All tags will be converted to lowercase. |

**Request**

```python
import starkbank

payments = starkbank.taxpayment.create([
    starkbank.TaxPayment(
        bar_code="81660000005003657010074119002551100010601813",
        scheduled="2023-08-02",
        description="fix the road",
        tags=["take", "my", "money"],
    )
])

for payment in payments:
    print(payment)
```

**Response**

```python
TaxPayment(
    amount=50036,
    bar_code=81660000005003657010074119002551100010601813,
    created=2023-01-24 18:03:18.662638,
    description=fix the road,
    fee=0,
    id=5186070702456832,
    line=81660000005 2 00365701007 4 41190025511 7 00010601813 8,
    scheduled=2023-08-02 11:00:00.000000,
    status=created,
    tags=["take", "my", "money"],
    transaction_ids=[],
    type=iss,
    updated=2023-01-24 18:03:18.000000
)
```

### List Tax Payments

`GET /v2/tax-payment`

Get a list of non-deleted tax payments 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. |
| `ids` | OPTIONAL | List of strings to get specific entities by ids. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `status` | OPTIONAL | Filter tax payments by the specified status. |
| `tags` | OPTIONAL | Filter entities that contain the specified tags. |

**Request**

```python
import starkbank

payments = starkbank.taxpayment.query(
    after="2023-01-01",
    before="2023-01-30"
)

for payment in payments:
    print(payment)
```

**Response**

```python
TaxPayment(
    amount=50036,
    bar_code=81660000005003657010074119002551100010601813,
    created=2023-01-24 18:03:18.662638,
    description=fix the road,
    fee=0,
    id=5186070702456832,
    line=81660000005 2 00365701007 4 41190025511 7 00010601813 8,
    scheduled=2023-08-02 11:00:00.000000,
    status=created,
    tags=["take", "my", "money"],
    transaction_ids=[],
    type=iss,
    updated=2023-01-24 18:03:18.000000
)
```

### Get a Tax Payment

`GET /v2/tax-payment/:id`

Get a single tax payment by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the tax payment entity. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

payment = starkbank.taxpayment.get("5186070702456832")

print(payment)
```

**Response**

```python
TaxPayment(
    amount=50036,
    bar_code=81660000005003657010074119002551100010601813,
    created=2023-01-24 18:03:18.662638,
    description=fix the road,
    fee=0,
    id=5186070702456832,
    line=81660000005 2 00365701007 4 41190025511 7 00010601813 8,
    scheduled=2023-08-02 11:00:00,
    status=created,
    tags=["take", "my", "money"],
    transaction_ids=[],
    type=iss,
    updated=2023-01-24 18:03:18.662638
)
```

### Delete a Tax Payment

`DELETE /v2/tax-payment/:id`

Cancel a scheduled tax payment. This is only allowed while the payment's status is "created", i.e. before Stark Bank has started processing it.

**NOTE:**Once processing has begun, or the payment has already been canceled, the delete request is rejected.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the tax payment entity. |

**Request**

```python
import starkbank

payment = starkbank.taxpayment.delete("5186070702456832")

print(payment)
```

**Response**

```python
TaxPayment(
    amount=50036,
    bar_code=81660000005003657010074119002551100010601813,
    created=2023-01-24 18:03:18.662638,
    description=fix the road,
    fee=0,
    id=5186070702456832,
    line=81660000005 2 00365701007 4 41190025511 7 00010601813 8,
    scheduled=2023-08-02 11:00:00.000000,
    status=canceled,
    tags=["take", "my", "money"],
    transaction_ids=[],
    type=iss,
    updated=2023-01-26 14:44:22.522334
)
```

### Get a Tax Payment PDF

`GET /v2/tax-payment/:id/pdf`

Get a tax payment PDF receipt. You can only get a receipt for payments whose status are either success, processing or created.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the tax payment entity |

**Request**

```python
import starkbank

pdf = starkbank.taxpayment.pdf("5186070702456832")

with open("tax-payment.pdf", "wb") as file:
    file.write(pdf)
```

### List Tax Payment Logs

`GET /v2/tax-payment/log`

Get a paged list of all tax payment logs. A log tracks a change in the payment entity according to its life cycle.

**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. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `paymentIds` | OPTIONAL | Array of payment ids linked to the desired logs. |
| `types` | OPTIONAL | Filters logs by log types. |

**Request**

```python
import starkbank

logs = starkbank.taxpayment.log.query(
    payment_ids=["5133524998815744"]
)

for log in logs:
    print(log)
```

**Response**

```python
Log(
    created=2023-01-18 16:49:06.080497,
    errors=[],
    id=5068165377687552,
    payment=TaxPayment(
        amount=8271,
        bar_code=85660000000827100640074119002551100010601813,
        created=2023-01-18 16:49:05.981612,
        description=paying taxes,
        fee=0,
        id=5133524998815744,
        line=85660000000 9 82710064007 3 41190025511 7 00010601813 8,
        scheduled=2023-01-20 11:00:00.000000,
        status=created,
        tags=['expensive'],
        transaction_ids=[],
        type=iss,
        updated=2023-01-20 15:00:01.494340
    ),
    type=created
)
```

### Get a Tax Payment Log

`GET /v2/tax-payment/log/:id`

Get a single tax payment log by its id.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the log entity |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkbank

log = starkbank.taxpayment.log.get("5068165377687552")

print(log)
```

**Response**

```python
Log(
    created=2023-01-18 16:49:06.080497,
    errors=[],
    id=5068165377687552,
    payment=TaxPayment(
        amount=8271,
        bar_code=85660000000827100640074119002551100010601813,
        created=2023-01-18 16:49:05.981612,
        description=paying taxes,
        fee=0,
        id=5133524998815744,
        line=85660000000 9 82710064007 3 41190025511 7 00010601813 8,
        scheduled=2023-01-20 11:00:00,
        status=created,
        tags=['expensive'],
        transaction_ids=[],
        type=iss,
        updated=2023-01-20 15:00:01.494340
    ),
    type=created
)
```

## 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/tax-payment-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/tax-payment-node.md)
- [PHP](https://docs.starkbank.com/api/v2/tax-payment-php.md)
- [Java](https://docs.starkbank.com/api/v2/tax-payment-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/tax-payment-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/tax-payment-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/tax-payment-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/tax-payment-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/tax-payment-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/tax-payment-curl.md)
