Ir para o conteúdo

Listing


Pix listing

listPixPayment()

Another method that can be used to query transactions is the payment list. This listing can be done using filters such as date, status or specific values. All of these filters can be combined, allowing a more precise and personalized query of transactions carried out in the specified period.

// query request
{
  "end_date": "Jul 12, 2024 11:01:35",
  "start_date": "Feb 1, 2024 11:01:35",
  "status": [
    "DEVOLVIDO"
  ]
}

Parameters

Name Type Mandatory Description
request listPixPayment Yes Data transfer object that will contain the pix request information. Note that not all parameters are mandatory.
callback ListPixPaymentCallback Yes Interface that will be executed for notifications of success or error in the pix process.

Parameter Details

request (listPixPayment)

Name Type Mandatory Description
start_date String Yes Filtering start date.
end_date String Yes Filtering end date.
status List<String> No List of transaction statuses for filtering.
value String No Filtering transaction value.

Parameter Details

callback (ListPixPaymentCallback)

Name Type Mandatory Description
onSuccess String Yes Method for notification in case of success.
onError String Yes Method for notification in case of error.
fun listPixService(
    pixClient: PixClient,
    startDateTime: Date,
    endDateTime: Date,
    listStatus: List<ChargeStatus>?,
    value: String?,
    listPix: (Array<ListPixResponse>) -> Unit
) {
    val gson: Gson = Gson()

    CoroutineScope(Dispatchers.Main).launch {
        val listPixRequest = ListPixRequest(startDateTime, endDateTime, listStatus, value)
        val callback = object : PixClient.ListPixPaymentCallback {
            override fun onError(response: String?) {
                println("Response $response")
            }

            override fun onSuccess(response: String?) {
                println("Response $response")
                val list = gson.fromJson(response, Array<ListPixResponse>::class.java)
                listPix(list)
            }
        }

        pixClient.listPixPayment(
            gson.toJson(listPixRequest),
            callback
        )
    }
}

ListPixRequest class example:

data class ListPixRequest(
    @SerializedName("start_date")
    val startDate: Date,
    @SerializedName("end_date")
    val endDate: Date,
    @SerializedName("status")
    val status: List<ChargeStatus>?,
    @SerializedName("value")
    val value: String?,
)

Example of the ListPixResponse class:

data class ListPixResponse(
    @SerializedName("cob_value")
    val cobValue: String,
    @SerializedName("pix_client_id")
    val clientId: String,
    @SerializedName("status")
    val status: String,
    @SerializedName("tx_id")
    val txId: String,
    @SerializedName("date_time")
    val pixDateTime: String,
)

In the case of the listing, an array with the following structure will be returned:

{
  "pix": [
    {
      "cob_value": "0.01",
      "date_time": "2024-06-11T10:59:20Z",
      "status": "REMOVIDA_PELO_USUARIO_RECEBEDOR",
      "tx_id": "bb87b47af1664bda988fe8c82a73a3b3"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-11T11:13:46Z",
      "status": "DEVOLVIDO",
      "tx_id": "827af752d7b04b61952871f43ced22c0"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-11T11:00:52Z",
      "status": "CONCLUIDA",
      "tx_id": "827af752d7b04b61952871f43ced22c0"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-11T11:13:00Z",
      "status": "REMOVIDA_PELO_USUARIO_RECEBEDOR",
      "tx_id": "f0cc13d80f7347de905512918d059ecd"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-12T12:28:50Z",
      "pix_client_id": "81abf3dc-7ab7-4645-99cc-3c23ab26fadb",
      "status": "DEVOLVIDO",
      "tx_id": "1997bd293a7245cdabb60db68effd4a5"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-12T12:27:36Z",
      "pix_client_id": "81abf3dc-7ab7-4645-99cc-3c23ab26fadb",
      "status": "CONCLUIDA",
      "tx_id": "1997bd293a7245cdabb60db68effd4a5"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-12T12:40:31Z",
      "pix_client_id": "abb87037-ff2e-4849-9767-dcab82c6c27a",
      "status": "EXPIRADA",
      "tx_id": "889b7815ec894d5aacd20cd88a077b12"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-13T11:54:26Z",
      "pix_client_id": "918976aa-bebc-4049-b9bf-3d7435f703da",
      "status": "REMOVIDA_PELO_USUARIO_RECEBEDOR",
      "tx_id": "aba04b6ad6494e7ea36916ce0f199349"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-18T08:45:22Z",
      "pix_client_id": "fdfe3199-a2e4-4459-9ce3-af5861790d09",
      "status": "REMOVIDA_PELO_USUARIO_RECEBEDOR",
      "tx_id": "f6324dab076c4b99aee9134c3bc96615"
    },
    {
      "cob_value": "0.02",
      "date_time": "2024-06-18T09:21:39Z",
      "pix_client_id": "853a6129-d5b9-4148-9597-fab003465c27",
      "status": "DEVOLVIDO",
      "tx_id": "36080b620fe2437984e66600e5f8ccf9"
    },
    {
      "cob_value": "0.02",
      "date_time": "2024-06-18T09:16:48Z",
      "pix_client_id": "853a6129-d5b9-4148-9597-fab003465c27",
      "status": "CONCLUIDA",
      "tx_id": "36080b620fe2437984e66600e5f8ccf9"
    },
    {
      "cob_value": "0.01",
      "date_time": "2024-06-18T09:58:42Z",
      "pix_client_id": "b068f3cd-440b-4c34-9608-5fe9847bedd5",
      "status": "CONCLUIDA",
      "tx_id": "82eea34e971441e8abd0f7ccaae0d3cc"
    }
  ]
}