# Payment Preview

A Payment Preview is used to get information from multiple types of payment to confirm any information before actually paying. If the 'scheduled' parameter is not informed, today will be assumed as the intended payment date. Right now, the 'scheduled' parameter only has effect on BrcodePreviews.

This resource is able to preview the following types of payment: "brcode-payment", "boleto-payment", "utility-payment" and "tax-payment"

### The Payment Preview object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Main identification of the payment (BR Code, line, or bar code). |
| `scheduled` | STRING | Intended payment date. Example: "2020-03-10". |
| `type` | STRING | Payment type. Options: "brcode-payment", "boleto-payment", "utility-payment", "tax-payment". |

### Create a Payment Preview

`POST /v2/payment-preview`

Create a payment preview to get information from a payment.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Main identification of the payment. This should be the BR Code for Pix payments and lines or bar codes for payment slips. Example: '34191.09008 63571.277308 71444.640008 5 81960000000062'. |
| `scheduled` | OPTIONAL | Intended payment date. Right now, this parameter only has effect on BrcodePreviews. Example: '2020-03-10' |

**Request**

```python
import starkbank

previews = starkbank.paymentpreview.create([
    starkbank.PaymentPreview(
        id="00020126580014br.gov.bcb.pix0136a629532e-7693-4846-852d-1bbff817b5a8520400005303986540510.005802BR5908T'Challa6009Sao Paulo62090505123456304B14A",
        scheduled="2023-01-29"
    )
])

for preview in previews:
    print(preview)
```

**Response**

```python
PaymentPreview(
    id=00020126580014br.gov.bcb.pix0136a629532e-7693-4846-852d-1bbff817b5a8520400005303986540510.005802BR5908T'Challa6009Sao Paulo62090505123456304B14A,
    payment=BrcodePreview(
        account_type=savings,
        allow_change=False,
        amount=1000,
        bank_code=01705236,
        cash_amount=0,
        cashier_bank_code=,
        cashier_type=,
        description=Descrição para o pagador,
        discount_amount=0,
        fine_amount=0,
        interest_amount=0,
        key_id=35719950-ac93-4bab-8ad6-56d7fb63afd2,
        name=Humberto EI,
        nominal_amount=1000,
        reconciliation_id=12345,
        reduction_amount=0,
        status=created,
        tax_id=27.564.801/0001-36
    ),
    scheduled=2023-01-29,
    type=brcode-payment
)
```

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