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

# Deal anlegen

POST https://api.trackleads.io/api/v1/transactions/create
Content-Type: application/json

Erfasst einen Kauf (Deal) für einen Lead. Einmalzahlungen und Ratenzahlungen nutzen denselben Endpunkt. Der Lead muss bereits existieren, rufe also vorher `/leads/upsert` auf. Ohne Lead-Kennung entsteht eine Transaktion ohne Lead (Buchungseintrag), dann ist `name` Pflicht.

Reference: https://docs.trackleads.io/api/referenz/deals/create-transaction

## Authentication

- `X-API-Key` header (required) — API-Key des Business. Alternativ als `Authorization: Bearer <key>`.

## Request

### Body (application/json)

This endpoint expects a TransactionCreate.

- `amount` (double, required) — Gesamtwert der Bestellung in EUR. Mit `rates` muss er der Summe aller Raten entsprechen. Deals mit Lead dürfen nicht negativ sein.
- `transaction_id` (string, optional) — Deine Bestellnummer. Muss pro Business eindeutig sein und ist die Kennung, über die du den Deal später ansprichst. Dringend empfohlen.
- `email` (string, optional) — Lead-Kennung. Der Lead muss bereits existieren.
- `phone` (string, optional) — Lead-Kennung. Der Lead muss bereits existieren.
- `custom_id` (string, optional) — Lead-Kennung (Trackleads-Lead-ID).
- `product` (string, optional) — Produktname. Wird bei der ersten Verwendung angelegt und danach über den Namen zugeordnet.
- `date` (date, optional) — Kaufdatum. Standard ist heute.
- `pending` (boolean, optional) — Zahlung noch nicht abgeschlossen, zum Beispiel angekündigte Überweisung.
- `payment_abort` (boolean, optional) — Checkout wurde gestartet, die Zahlung ist aber fehlgeschlagen oder abgebrochen.
- `rates` (list of Rate, optional) — Raten eines Zahlungsplans. Nur bei Deals mit Lead erlaubt und nicht kombinierbar mit `pending` oder `payment_abort` auf dem Deal.
- `tags` (list of string, optional) — Deal-Tags. Fehlende Tags werden angelegt.
- `employee_setter` (string, optional) — Setter aus dem Sales-Team, per Anzeigename oder E-Mail.
- `employee_closer` (string, optional) — Closer aus dem Sales-Team, per Anzeigename oder E-Mail.
- `name` (string, optional) — Nur für Transaktionen ohne Lead-Kennung (Buchungseinträge), dort Pflicht. Deals leiten ihren Namen vom Lead ab.

## Response

### 201

Der Deal wurde angelegt.

- `ok` (boolean, optional)
- `transaction_id` (string, optional)
- `rates` (list of TransactionCreateResponseRatesItems, optional) — Nur bei Zahlungsplänen. Jede Rate mit eigener `transaction_id`.

## Errors

### 401 Unauthorized Error

API-Key fehlt oder ist ungültig.

- `ok` (boolean, optional)
- `error` (enum, optional)
  - Allowed values: `API_KEY_MISSING`, `API_KEY_INVALID`

### 422 Unprocessable Entity Error

Validierung fehlgeschlagen, zum Beispiel "Lead not found", eine doppelte `transaction_id` oder ein unbekannter Status.

- `message` (string, optional)
- `errors` (map from string to list of string, optional)

### 429 Too Many Requests Error

Rate-Limit überschritten. Warte die Sekunden aus dem Header `Retry-After` ab.

- `any`

## Types

### Rate

- `date` (date, required) — Fälligkeits- oder Zahlungsdatum der Rate.
- `amount` (double, required) — Betrag der Rate in EUR.
- `pending` (boolean, optional) — `true` für Raten, die noch nicht bezahlt sind.

### TransactionCreateResponseRatesItems

- `transaction_id` (string, optional)
- `date` (date, optional)
- `amount` (double, optional)
- `pending` (boolean, optional)

## Examples

### Einmalzahlung

**Request**

```json
{
  "amount": 499,
  "transaction_id": "ORDER-1000",
  "email": "jane@example.com",
  "product": "Coaching Program",
  "date": "2026-11-13"
}
```

**Response**

```json
{
  "ok": true,
  "transaction_id": "ORDER-1000"
}
```

**SDK Code**

```python Einmalzahlung
import requests

url = "https://api.trackleads.io/api/v1/transactions/create"

payload = {
    "amount": 499,
    "transaction_id": "ORDER-1000",
    "email": "jane@example.com",
    "product": "Coaching Program",
    "date": "2026-11-13"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Einmalzahlung
const url = 'https://api.trackleads.io/api/v1/transactions/create';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"amount":499,"transaction_id":"ORDER-1000","email":"jane@example.com","product":"Coaching Program","date":"2026-11-13"}'
};

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

```go Einmalzahlung
package main

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

func main() {

	url := "https://api.trackleads.io/api/v1/transactions/create"

	payload := strings.NewReader("{\n  \"amount\": 499,\n  \"transaction_id\": \"ORDER-1000\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"date\": \"2026-11-13\"\n}")

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

	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 Einmalzahlung
require 'uri'
require 'net/http'

url = URI("https://api.trackleads.io/api/v1/transactions/create")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 499,\n  \"transaction_id\": \"ORDER-1000\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"date\": \"2026-11-13\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.trackleads.io/api/v1/transactions/create")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 499,\n  \"transaction_id\": \"ORDER-1000\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"date\": \"2026-11-13\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.trackleads.io/api/v1/transactions/create', [
  'body' => '{
  "amount": 499,
  "transaction_id": "ORDER-1000",
  "email": "jane@example.com",
  "product": "Coaching Program",
  "date": "2026-11-13"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp Einmalzahlung
using RestSharp;

var client = new RestClient("https://api.trackleads.io/api/v1/transactions/create");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": 499,\n  \"transaction_id\": \"ORDER-1000\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"date\": \"2026-11-13\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Einmalzahlung
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": 499,
  "transaction_id": "ORDER-1000",
  "email": "jane@example.com",
  "product": "Coaching Program",
  "date": "2026-11-13"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.trackleads.io/api/v1/transactions/create")! 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()
```

### Ratenzahlung

**Request**

```json
{
  "amount": 300,
  "transaction_id": "ORDER-1001",
  "email": "jane@example.com",
  "product": "Coaching Program",
  "rates": [
    {
      "date": "2026-11-13",
      "amount": 100
    },
    {
      "date": "2026-12-13",
      "amount": 100,
      "pending": true
    },
    {
      "date": "2027-01-13",
      "amount": 100,
      "pending": true
    }
  ]
}
```

**Response**

```json
{
  "ok": true,
  "transaction_id": "ORDER-1001",
  "rates": [
    {
      "transaction_id": "A1B2C3D4",
      "date": "2026-11-13",
      "amount": 100,
      "pending": false
    },
    {
      "transaction_id": "C3D4E5F6",
      "date": "2026-12-13",
      "amount": 100,
      "pending": true
    },
    {
      "transaction_id": "E5F6A7B8",
      "date": "2027-01-13",
      "amount": 100,
      "pending": true
    }
  ]
}
```

**SDK Code**

```python Ratenzahlung
import requests

url = "https://api.trackleads.io/api/v1/transactions/create"

payload = {
    "amount": 300,
    "transaction_id": "ORDER-1001",
    "email": "jane@example.com",
    "product": "Coaching Program",
    "rates": [
        {
            "date": "2026-11-13",
            "amount": 100
        },
        {
            "date": "2026-12-13",
            "amount": 100,
            "pending": True
        },
        {
            "date": "2027-01-13",
            "amount": 100,
            "pending": True
        }
    ]
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Ratenzahlung
const url = 'https://api.trackleads.io/api/v1/transactions/create';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"amount":300,"transaction_id":"ORDER-1001","email":"jane@example.com","product":"Coaching Program","rates":[{"date":"2026-11-13","amount":100},{"date":"2026-12-13","amount":100,"pending":true},{"date":"2027-01-13","amount":100,"pending":true}]}'
};

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

```go Ratenzahlung
package main

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

func main() {

	url := "https://api.trackleads.io/api/v1/transactions/create"

	payload := strings.NewReader("{\n  \"amount\": 300,\n  \"transaction_id\": \"ORDER-1001\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"rates\": [\n    {\n      \"date\": \"2026-11-13\",\n      \"amount\": 100\n    },\n    {\n      \"date\": \"2026-12-13\",\n      \"amount\": 100,\n      \"pending\": true\n    },\n    {\n      \"date\": \"2027-01-13\",\n      \"amount\": 100,\n      \"pending\": true\n    }\n  ]\n}")

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

	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 Ratenzahlung
require 'uri'
require 'net/http'

url = URI("https://api.trackleads.io/api/v1/transactions/create")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 300,\n  \"transaction_id\": \"ORDER-1001\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"rates\": [\n    {\n      \"date\": \"2026-11-13\",\n      \"amount\": 100\n    },\n    {\n      \"date\": \"2026-12-13\",\n      \"amount\": 100,\n      \"pending\": true\n    },\n    {\n      \"date\": \"2027-01-13\",\n      \"amount\": 100,\n      \"pending\": true\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.trackleads.io/api/v1/transactions/create")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 300,\n  \"transaction_id\": \"ORDER-1001\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"rates\": [\n    {\n      \"date\": \"2026-11-13\",\n      \"amount\": 100\n    },\n    {\n      \"date\": \"2026-12-13\",\n      \"amount\": 100,\n      \"pending\": true\n    },\n    {\n      \"date\": \"2027-01-13\",\n      \"amount\": 100,\n      \"pending\": true\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.trackleads.io/api/v1/transactions/create', [
  'body' => '{
  "amount": 300,
  "transaction_id": "ORDER-1001",
  "email": "jane@example.com",
  "product": "Coaching Program",
  "rates": [
    {
      "date": "2026-11-13",
      "amount": 100
    },
    {
      "date": "2026-12-13",
      "amount": 100,
      "pending": true
    },
    {
      "date": "2027-01-13",
      "amount": 100,
      "pending": true
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp Ratenzahlung
using RestSharp;

var client = new RestClient("https://api.trackleads.io/api/v1/transactions/create");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": 300,\n  \"transaction_id\": \"ORDER-1001\",\n  \"email\": \"jane@example.com\",\n  \"product\": \"Coaching Program\",\n  \"rates\": [\n    {\n      \"date\": \"2026-11-13\",\n      \"amount\": 100\n    },\n    {\n      \"date\": \"2026-12-13\",\n      \"amount\": 100,\n      \"pending\": true\n    },\n    {\n      \"date\": \"2027-01-13\",\n      \"amount\": 100,\n      \"pending\": true\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Ratenzahlung
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": 300,
  "transaction_id": "ORDER-1001",
  "email": "jane@example.com",
  "product": "Coaching Program",
  "rates": [
    [
      "date": "2026-11-13",
      "amount": 100
    ],
    [
      "date": "2026-12-13",
      "amount": 100,
      "pending": true
    ],
    [
      "date": "2027-01-13",
      "amount": 100,
      "pending": true
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.trackleads.io/api/v1/transactions/create")! 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()
```