---
title: "Wait for Pix payment"
method: GET
path: "/v1/transactions/{transaction_id}/pix/{payment_id}/sse"
tags: ["Transactions"]
---

# Wait for Pix payment

`GET /v1/transactions/{transaction_id}/pix/{payment_id}/sse`

## Request

- Base URL: `https://api.edubank.com.br` (the document declares no server; this is the origin it was published from)
- URL: `https://api.edubank.com.br/v1/transactions/{transaction_id}/pix/{payment_id}/sse`
- Auth: one of:
  - API key in header `x-api-key`
  - API key in header `authorization`
- TypeScript: <https://skmtc.dev/edubank/apis/api-edubank/docs/v1/transactions/:transaction_id/pix/:payment_id/sse/get.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint employs the Server-Sent Events (SSE) resource to establish a communication channel between the client and server.

Consumption of this endpoint is achieved by utilizing an `EventSource`

Below is a simple example illustrating the usage of the `EventSource`:

```javascript
const eventSource = new EventSource(
  'https://api.edubank.com.br/v1/transactions/{transaction_id}/pix/{payment_id}/sse',
);
eventSource.onmessage = ({ data }) => {
  console.log('New message', JSON.parse(data));
};
````

## Important point
- It is crucial to remember that the `x-api-key` and `authorization` must be included in the call to the Edubank API
- For smoother inclusion of the `x-api-key` and `authorization` headers in the call, we recommend using the `event-source-polyfill` package. You can find this package on [event-source-polyfill](https://www.npmjs.com/package/event-source-polyfill)
- The `EventSource` should be closed upon receiving the desired message.

## Path parameters

- `payment_id` string, required
- `transaction_id` string, required

## Response `200`

Connection successfully stabilized.

- EdubankMessageEventPixSse
  - `id` string, required: Message event id
  - `data` EdubankPixSse, required
    - `status_code` number, required: Status code
    - `status` string, required: Event status
    - `message` string, required: Event message
    - `payment_event` EdubankSendEvent, required
      - `event_id` string, required: Event id
      - `create_at` string, required: When the event was raised
      - `seller_id` string, required: Seller id
      - `transaction_id` string: Transaction id
      - `subscription_id` string: Subscription id
      - `payment_method` EdubankPixNotification, required
        - `status` 'PAID' | 'CREATED' | 'CANCELED' | 'REFUNDED' | 'VOIDED' | 'SETTLED' | 'OVERDUE' | 'EXPIRED' | 'ACTIVE' | 'CHARGED_BACK' | 'DISPUTED', required: Transaction status
        - `payment_id` string, required: Payment id
        - `reference_id` string, required: Reference ID of your application VARCHAR(500)
        - `payment_type` string, required: Payment type
        - `payment_amount` number, required: Payment amount
        - `payment_confirmed` boolean, required: If the payment has been confirmed
        - `payment_canceled` boolean, required: If the payment has been canceled
        - `payment_received_at` string, required: When payment was received
        - `expected_on` string, required: Credit date
        - `fees` string, required: Fees
        - `pix_qrcode` string, required: Pix qrcode
        - `pix_expiration` string, required: Pix expiration
        - `pix_authorization_code` string, required: Pix settlement authorization code

## Other responses

- `401`: The user is unauthorized
- `422`: Error: Unprocessable Entity
- `500`: Internal server error
- `default`: Client specified an invalid argument, request body or query param

---

[API](https://skmtc.dev/edubank/apis/api-edubank.md) - [All operations](https://skmtc.dev/edubank/apis/api-edubank/llms.txt) - [OpenAPI document](https://skmtc.dev/edubank/apis/api-edubank/revisions/dce4008191d4?raw)
