# Retrieve Wallet QR-code by ID

<mark style="color:green;">`GET`</mark> `/wallet/{id}/qrcode`

Get qr-code for your wallet by ID.

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| X-API-KEY    | `<token>`          |

**Response**

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

```json
{
    "qrcode": "base64stirng"
}
```

{% endtab %}

{% tab title="404" %}

```json
{
    "detail": "Wallet does not exist"
}
```

{% endtab %}

{% tab title="422" %}

```json
{
    "detail": [
        {
            "loc": [],
            "msg": "string",
            "type": "string"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

**Example**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://api.nord-pay.com/wallet/your-wallet-id/qrcode" \
     -H "Content-Type: application/json" \
     -H "X-API-KEY: YOUR_API_KEY"
```

{% endtab %}

{% tab title="Python (requests)" %}

```python
import requests

def get_wallet_qrcode(wallet_id):
    url = f"https://api.nord-pay.com/wallet/{wallet_id}/qrcode"
    headers = {
        "Content-Type": "application/json",
        "X-API-KEY": "YOUR_API_KEY"
    }
    resp = requests.get(url, headers=headers)
    resp.raise_for_status()
    data = resp.json()
    return data.get("qrcode")

# usage:
qr_b64 = get_wallet_qrcode("your-wallet-id")
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
function getWalletQrcode(string $walletId): ?string {
    $ch = curl_init("https://api.nord-pay.com/wallet/{$walletId}");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER     => [
            "Content-Type: application/json",
            "X-API-KEY: YOUR_API_KEY"
        ],
    ]);
    $response = curl_exec($ch);
    curl_close($ch);

    $data = json_decode($response, true);
    return $data['qrcode'] ?? null;
}

// usage:
$qrB64 = getWalletQrcode("your-wallet-id");
// file_put_contents('qrcode.png', base64_decode($qrB64));
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
async function loadWalletQrcode(walletId) {
  const response = await fetch(`https://api.nord-pay.com/wallet/${walletId}`, {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      "X-API-KEY": "YOUR_API_KEY"
    }
  });
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  const { qrcode } = await response.json();
  return qrcode;
}

// usage:
loadWalletQrcode("your-wallet-id").then(qrB64 => {
  document.querySelector('#qr').src = `data:image/png;base64,${qrB64}`;
});
```

{% endtab %}

{% tab title="Node.js (axios)" %}

```javascript
const axios = require('axios');

async function getWalletQrcode(walletId) {
  const { data } = await axios.get(
    `https://api.nord-pay.com/wallet/${walletId}`,
    {
      headers: {
        'Content-Type': 'application/json',
        'X-API-KEY': 'YOUR_API_KEY'
      }
    }
  );
  return data.qrcode;
}

// usage:
getWalletQrcode("your-wallet-id").then(qrB64 => {
});
```

{% endtab %}
{% endtabs %}
