> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tiankii.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tiankii.com/_mcp/server.

# Update payment link

PATCH https://api.md.tiankii.com/v1/payment-requests/links/{id}
Content-Type: application/json

## Update payment link

Partially updates an existing payment link owned by the authenticated store. The body is a partial of the create DTO (all fields optional), and the supplied fields are shallow-merged over the link's existing `Data` blob.

### Behavior & side-effects

* The link is looked up by `:id` scoped to `user.store_id` (404 if not found for this store).
* `PaymentRequestLifecycleService.assertUpdatable` runs — the request must be in an updatable state (e.g. not COMPLETED/EXPIRED/DEACTIVATED), otherwise the update is rejected.
* `assertImmutableFieldsUnchanged` runs — fields considered immutable once invoices exist for the link cannot be changed; attempting to change them fails.
* If `appId` is supplied it replaces the current app association; otherwise the existing `AppId` is preserved.
* Remaining fields are merged into the existing data (`{ ...oldData, ...data }`).

### Authentication

* Send the merchant API key in the **`x-api-key`** header (alias `x-account-api-key`).
* Requires scope **`Merchant.payment_link.update`**.
* Optionally scope the key to a specific store/account with the **`x-application-account-id`** header (alias `x-account-id`) or the `application_account_id` / `account_id` query param.

### Path params

* `id` — the payment link (payment request) id.

### Body (application/json)

Any subset of the create-payment-link fields (see the Create payment link endpoint for the full field list, types, and conditional constraints). All fields are optional here (`PartialType`). Unknown properties are stripped by the global whitelist ValidationPipe.

### Response

`200 OK` with the updated, presented `PaymentLinkResponseDto`.

***

**Notas:** Deprecated alias paths PATCH /v1/payment-links/:id and PATCH /v1/payment-link/:id route to this same handler. Full body field list, types and conditional constraints are identical to the Create payment link endpoint (this DTO is PartialType(CreatePaymentLinkDto)); only a representative subset is enumerated here. Update is rejected if the link is not in an updatable lifecycle state (assertUpdatable) or if immutable fields are changed after invoices exist (assertImmutableFieldsUnchanged).

Reference: https://docs.tiankii.com/api-reference/tiankii-api-api-key/payment-requests/payment-links/update

## Authentication

- `x-api-key` header (required)

## Request

### Path parameters

- `id` (string, required) — Id of the payment link (payment request) to update. Must belong to the authenticated store.

### Headers

- `x-application-account-id` (string, optional) — Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the `x-account-id` header, or the `application_account_id` / `account_id` query parameter.

### Body (application/json)

- `title` (string, optional)
- `amount` (double, optional)
- `description` (string, optional)

## Examples

**Request**

```json
{
  "title": "Premium Plan (updated)",
  "amount": 1.5,
  "description": "Updated description"
}
```

**SDK Code**

```python
import requests

url = "https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10"

payload = {
    "title": "Premium Plan (updated)",
    "amount": 1.5,
    "description": "Updated description"
}
headers = {
    "x-application-account-id": "acct_3f9a21c7",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10';
const options = {
  method: 'PATCH',
  headers: {
    'x-application-account-id': 'acct_3f9a21c7',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"title":"Premium Plan (updated)","amount":1.5,"description":"Updated description"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10"

	payload := strings.NewReader("{\n  \"title\": \"Premium Plan (updated)\",\n  \"amount\": 1.5,\n  \"description\": \"Updated description\"\n}")

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

	req.Header.Add("x-application-account-id", "acct_3f9a21c7")
	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10")

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

request = Net::HTTP::Patch.new(url)
request["x-application-account-id"] = 'acct_3f9a21c7'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"title\": \"Premium Plan (updated)\",\n  \"amount\": 1.5,\n  \"description\": \"Updated description\"\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10")
  .header("x-application-account-id", "acct_3f9a21c7")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"title\": \"Premium Plan (updated)\",\n  \"amount\": 1.5,\n  \"description\": \"Updated description\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10', [
  'body' => '{
  "title": "Premium Plan (updated)",
  "amount": 1.5,
  "description": "Updated description"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
    'x-application-account-id' => 'acct_3f9a21c7',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-application-account-id", "acct_3f9a21c7");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"title\": \"Premium Plan (updated)\",\n  \"amount\": 1.5,\n  \"description\": \"Updated description\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-application-account-id": "acct_3f9a21c7",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "title": "Premium Plan (updated)",
  "amount": 1.5,
  "description": "Updated description"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.md.tiankii.com/v1/payment-requests/links/pr_7f3a9c2e10")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```