# Get Payment Status (server-to-server)

An essential aspect of managing your payments is having the ability to retrieve and analyze their statuses.&#x20;

{% hint style="warning" %}

#### <mark style="color:orange;">Warning</mark>

CoinbarPay payment gateway automatically send a callback response to configured webhook callback url previously configured.

For more informations please refer to [Post payments actions](/api-web-integration/api-documentation/payment-gateway.md#id-1-backend-callback)
{% endhint %}

Otherwise you can just call the following API to retrieve a payment status by client request payment id.

## Get Payment Status

The API will return a JSON object containing the status details of the requested payment.

## Get payment details

<mark style="color:blue;">`GET`</mark> `https://sandbox.coinbar.io/coinbar/api/v2/pay/gateway/payment/{{payment_request_id}}/status`

#### Path Parameters

| Name                 | Type   | Description                                    |
| -------------------- | ------ | ---------------------------------------------- |
| payment\_request\_id | String | Payment Request Id used to request the payment |

#### Headers

| Name                                            | Type   | Description                                                              |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------ |
| CBPAY-API-KEY<mark style="color:red;">\*</mark> | String | {{<mark style="color:purple;">`SERVICE_CLIENT_ID`</mark>}}               |
| Content-Type                                    | String | application/json                                                         |
| SIGNATURE                                       | String | <p>{{<code>SIGNATURE\_TOKEN</code>}}<br>HMAC SHA-256 body validation</p> |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "payment_id_coinbar": "XxYyWwZz-XxYy-XxYy-XxYy-XxYyWwZz",
    "payment_request_id_client": "XxYyWwZz-XxYy-XxYy-XxYy-XxYyWwZz",
    "service_client_id": "XxYyWwZz-XxYy-XxYy-XxYy-XxYyWwZz",
    "status": "FAILED",
    "payment_detail": {
        "destination_coin": "BTC",
        "trade_pair": "BTC/EUR",
        "destination_amount": 0.00045145423250897323,
        "coin_change": 19913.425,
        "total_price": 8.99
    },
    "input_coin": "EUR",
    "creation_time": "2022-05-11T12:16:01.064Z",
    "update_time": "2022-05-11T12:30:35.059Z",
    "status_descr": "Timeout"
}
```

{% endtab %}
{% endtabs %}


---

# 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://docs.coinbar.io/api-web-integration/api-documentation/get-payment-status-server-to-server.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.
