# Retrieve Payments

## Overview

There's two available endpoints to retrieve data on existing orders:

1. [**Get Payment By ID**](#get-payment-by-id) - Retrieves a single payment by utilizing it's ID as a query parameter
2. [**List Payments**](#list-payments) - Retrieves a list of payments with optional query parameters to filter results

***

### Possible Payment States

<table><thead><tr><th width="221">State</th><th>Description</th></tr></thead><tbody><tr><td><strong>NOT_STARTED</strong></td><td>Active payment that has not been started yet</td></tr><tr><td><mark style="color:red;"><strong>EXPIRED</strong></mark></td><td>Expired payment that is no longer active</td></tr><tr><td><mark style="color:orange;"><strong>PENDING</strong></mark></td><td>Active payment which has been accessed by a client</td></tr><tr><td><mark style="color:blue;"><strong>CAPTURED</strong></mark></td><td>Card payment successful, awaiting cryptocurrency transfer</td></tr><tr><td><mark style="color:green;"><strong>COMPLETE</strong></mark></td><td>Completed payment and cryptocurrency transfer</td></tr></tbody></table>

***

### Get Payment By ID

The `/quickbuy/v1/get` endpoint is designed to retrieve detailed information about a specific payment using its unique Payment ID. This allows merchants and clients to track the status and details of a transaction.

* **Endpoint**: `/quickbuy/v1/get`
* **Method:** `GET`

#### **Request Query**

* OrderID: ID of the order to be retrieved

#### Response Body

The response will provide comprehensive details about the payment associated with the specified Payment ID, including transaction status, payment details, client information, and any relevant timestamps.

This endpoint is crucial for monitoring individual transactions, providing a reliable method for both merchants and clients to access current and accurate payment information.

#### Example (200 OK)

```json5
{
    "success": true,
    "details": {
        "id": "662282ec1746ac93544cdd26",
        "status": "NOT_STARTED",
        "client": {
            "UserReference": "john-doe-1234-user"
        },
        "fiat": {
            "amount": 121.12,
            "currency": "USD"
        },
        "DateCreated": "2024-04-19T14:42:52.554Z"
    }
}
```

***

### List Payments

The `/quickbuy/v1/list` endpoint provides a mechanism for retrieving a list of payments, offering flexibility through various query parameters. This allows merchants to view multiple payments based on specified criteria such as date ranges, payment statuses, and more, making it easier to manage and analyze payment transactions.

* **Endpoint**: `/quickbuy/v1/list`
* **Method:** `GET`

#### Query Parameteres

* **`PageSize`** (optional, default = 10, max 1000): Number of results to be displayed
* **`HideExpired`** (optional, boolean, lowercase): When true, expired payments will be hidden
* **`State`** (optional): Filter by payment state, refer to [Possible Payment States](#possible-payment-states)

#### Response Body Example (200 OK)

```json5
{
    "success": true,
    "quantity": 3,
    "details": [
        {
            "id": "66251ea1b81def2bad344760",
            "status": "CAPTURED",
            "client": {
                "UserReference": "john-doe-1234-user"
            },
            "fiat": {
                "amount": 262.91,
                "currency": "USD"
            },
            "DateCreated": "2024-04-21T14:11:45.465Z",
            "ExpireDate": "2024-04-22T14:11:45.445Z",
            "CaptureDate": "2024-04-21T14:11:45.465Z"
        },
        {
            "id": "66251f21c12e178b83c2a3be",
            "status": "PENDING",
            "client": {
                "UserReference": "john-doe-1234-user"
            },
            "fiat": {
                "amount": 102.96,
                "currency": "USD"
            },
            "DateCreated": "2024-04-21T14:13:53.743Z",
            "ExpireDate": "2024-04-22T14:13:53.739Z"
        },
        {
            "id": "662528dccc21be7cb5e8aeb7",
            "status": "NOT_STARTED",
            "client": {
                "UserReference": "john-doe-1234-user"
            },
            "fiat": {
                "amount": 11.96,
                "currency": "USD"
            },
            "DateCreated": "2024-04-21T14:55:24.876Z",
            "ExpireDate": "2024-04-22T14:55:24.866Z"
        },
        
        /* ...more payments... */
    ]
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://customer-api-docs.ibanera.com/quickbuy/quickbuy-pro/api-endpoints/retrieve-payments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
