> 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.

# Create payment link

POST https://api.md.tiankii.com/v1/payment-requests/links
Content-Type: application/json

## Create payment link

Creates a new **payment link** for the authenticated merchant's store. A payment link is a shareable, hosted payment page that can collect one or many payments in the configured currency.

The link is created as a `PaymentRequests` record of type `PAYMENT_LINK`. Every DTO field beyond the shared base fields is stored inside the request's JSON `Data` blob and returned back via the presenter. The store is resolved from the authenticated principal (`user.store_id`); you do not pass a store id in the body.

### Authentication

* Send the merchant API key in the **`x-api-key`** header (alias `x-account-api-key`).
* Requires scope **`Merchant.payment_link.create`**.
* 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.

### Body (application/json)

Core fields (required): `amount`, `currency`, `title`, `frecuency`.

Conditional requirements enforced by validation:

* `frecuencyData` is required when `frecuency = RECURRING` (must be a JSON string).
* `quantity` (min 1) is required when `allowCustomQuantity` is false/absent; otherwise supply `quantityRange` (\{ min, max }) when `allowCustomQuantity` is true.
* `limitNumberOfPayments` is required when `allowLimitNumberOfPayments` is true.
* `customconfirmMessage` is expected when `showConfirmPage` is true.
* `securityPin` is expected when `requirePinValidation` is true.
* `pdfConfig` is only validated when `allowPartialPayment` is true.

Buyer-detail collection fields (`requestContactDetails`, `requestEmail`, `requestPhone`, `requestAddress`, `requestReference`) accept a boolean OR one of the `FieldRequirementStrategy` enum values (`REQUIRED`, `OPTIONAL`, `HIDDEN`). `fieldRequirementStrategy` sets the global fallback strategy for fields set to `true` (defaults to `REQUIRED`).

Unknown properties are stripped by the global ValidationPipe (`whitelist: true`).

### Response

Returns `201 Created` with the presented `PaymentLinkResponseDto` (envelope fields + the payment-link data fields listed in `PAYMENT_LINK_DATA_FIELDS`).

### Related / deprecated aliases

The legacy paths `POST /v1/payment-links` and `POST /v1/payment-link` map to this same handler and remain for backward compatibility.

***

**Notas:** Deprecated alias paths POST /v1/payment-links and POST /v1/payment-link route to this same handler. The store id is taken from the authenticated principal (user.store\_id), not the body. Only fields listed in PAYMENT\_LINK\_DATA\_FIELDS are echoed back in the response; unknown body properties are stripped by the global whitelist ValidationPipe.

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

## Authentication

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

## Request

### 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)

- `amount` (double, required)
- `currency` (string, required)
- `title` (string, required)
- `frecuency` (string, required) — ONE_TIME | MULTIPLE | RECURRING. `frecuencyData` (JSON string) becomes required when RECURRING.
- `quantity` (integer, required) — Required unless `allowCustomQuantity` is true — in that case send `quantityRange` (\{ min, max }) instead.

## Examples

**Request**

```json
{
  "amount": 1.5,
  "currency": "USD",
  "title": "Premium Plan",
  "frecuency": "MULTIPLE",
  "quantity": 1
}
```

**SDK Code**

```python
import requests

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

payload = {
    "amount": 1.5,
    "currency": "USD",
    "title": "Premium Plan",
    "frecuency": "MULTIPLE",
    "quantity": 1
}
headers = {
    "x-application-account-id": "acct_3f9a21c7",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.md.tiankii.com/v1/payment-requests/links';
const options = {
  method: 'POST',
  headers: {
    'x-application-account-id': 'acct_3f9a21c7',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"amount":1.5,"currency":"USD","title":"Premium Plan","frecuency":"MULTIPLE","quantity":1}'
};

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"

	payload := strings.NewReader("{\n  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Premium Plan\",\n  \"frecuency\": \"MULTIPLE\",\n  \"quantity\": 1\n}")

	req, _ := http.NewRequest("POST", 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")

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

request = Net::HTTP::Post.new(url)
request["x-application-account-id"] = 'acct_3f9a21c7'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Premium Plan\",\n  \"frecuency\": \"MULTIPLE\",\n  \"quantity\": 1\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.post("https://api.md.tiankii.com/v1/payment-requests/links")
  .header("x-application-account-id", "acct_3f9a21c7")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Premium Plan\",\n  \"frecuency\": \"MULTIPLE\",\n  \"quantity\": 1\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.md.tiankii.com/v1/payment-requests/links', [
  'body' => '{
  "amount": 1.5,
  "currency": "USD",
  "title": "Premium Plan",
  "frecuency": "MULTIPLE",
  "quantity": 1
}',
  '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");
var request = new RestRequest(Method.POST);
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  \"amount\": 1.5,\n  \"currency\": \"USD\",\n  \"title\": \"Premium Plan\",\n  \"frecuency\": \"MULTIPLE\",\n  \"quantity\": 1\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 = [
  "amount": 1.5,
  "currency": "USD",
  "title": "Premium Plan",
  "frecuency": "MULTIPLE",
  "quantity": 1
] 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")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```