# Read a payment link

`GET /businesses/{bid}/payment-requests/{id}`

Requires the `documents` scope.

## Path parameters

| Name | Type | | Description |
|---|---|---|---|
| `bid` | string | **required** | Business id, from `POST /businesses`. |
| `id` | string | **required** | Payment request id. |

## Response

`200`: `{ "ok": true, … }`

| Field | Type | | Description |
|---|---|---|---|
| `ok` | boolean | **required** |  |
| `paymentRequest` | PaymentRequest | **required** | A request for a payment and its public link. When the card company confirms the payment, BillOS issues the receipt itself: a קבלה (400) for an invoice it pays, a חשבונית מס/קבלה (320) for a proforma or for its own lines (a 400 for an עוסק פטור), and the invoice it paid is closed. |

Errors: `400`, `401`, `403`, `404`, `429`. Every failure answers `{ "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }`: branch on `reason`, and read `hint` for what to change (https://docs.billos.co.il/errors.md).

## Examples

### cURL

```bash
curl -X GET "$BASE/businesses/$BID/payment-requests/$DOC_ID" \
  -H "X-Api-Key: $KEY"
```
### Node

```node
const res = await fetch(`${BASE}/businesses/${BID}/payment-requests/${DOC_ID}`, {
  method: 'GET',
  headers: {
    'X-Api-Key': KEY,
  },
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
```
### Python

```python
import requests
res = requests.get(
    f"{BASE}/businesses/{BID}/payment-requests/{DOC_ID}",
    headers={"X-Api-Key": KEY},
)
data = res.json()
```
### PHP

```php
$ch = curl_init("$BASE/businesses/$BID/payment-requests/$DOC_ID");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["X-Api-Key: $KEY"],
]);
$data = json_decode(curl_exec($ch), true);
```
### C#

```csharp
using System.Text.Json;

using var http = new HttpClient();
using var req = new HttpRequestMessage(HttpMethod.Get, $"{BASE}/businesses/{BID}/payment-requests/{DOC_ID}");
req.Headers.Add("X-Api-Key", KEY);
using var res = await http.SendAsync(req);
var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync()).RootElement;
```