## Update a crypto settlement destination

### cURL

```bash
curl --request PUT \
  --url https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id} \
  --header 'Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "destination": "<string>"
}
'```

### Python

```python
import requests

url = "https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id}"

payload = { "destination": "<string>" }
headers = {
    "Api-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

### JavaScript (Fetch API)

```javascript
const options = {
  method: 'PUT',
  headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({destination: '<string>'})
};

fetch('https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'destination' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Api-Key: <api-key>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id}"

payload := strings.NewReader("{\n  \"destination\": \"<string>\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Api-Key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### Java

```java
HttpResponse<String> response = Unirest.put("https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id}")
  .header("Api-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"destination\": \"<string>\"\n}")
  .asString();
```

### Ruby

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.pay.walletconnect.com/v1/merchants/{merchantId}/settlements/crypto/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"destination\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
```

### Example Response

```json
{
  "id": "crypto_Xk7nWp8XmQj2YrTv6",
  "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "destination": "eip155:8453:0x1234567890abcdef1234567890abcdef12345678"
}
```

### Authorization
- **Api-Key** (string, header, required)

### Path Parameters
- **id** (string, required): Crypto settlement ID. Required string length: `1 - 256`
- **merchantId** (string, required)

### Body
- **destination** (string, required): [CAIP-10](https://chainagnostic.org/CAIPs/caip-10) account identifier for the wallet that should receive the settled funds. Format: `<namespace>:<chain_reference>:<address>`. The chain must match the chain of the corresponding asset. Required string length: `1 - 256`

### Response
- **200** application/json: Settlement updated
- **id** (string, required): Crypto settlement ID
- **asset** (string, required): [CAIP-19](https://chainagnostic.org/CAIPs/caip-19) asset identifier for the token to settle in.
- **destination** (string, required): [CAIP-10](https://chainagnostic.org/CAIPs/caip-10) account identifier for the wallet.
