curl --request PUT \
--url https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Tenant: <x-tenant>' \
--data '
{
"account_id": 123
}
'import requests
url = "https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}"
payload = { "account_id": 123 }
headers = {
"X-Tenant": "<x-tenant>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Tenant': '<x-tenant>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({account_id: 123})
};
fetch('https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}",
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([
'account_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Tenant: <x-tenant>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}"
payload := strings.NewReader("{\n \"account_id\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Tenant", "<x-tenant>")
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.put("https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Tenant"] = '<x-tenant>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": "<string>",
"data": {
"sale_id": "<string>",
"remaining_balance": "<string>",
"payments": {
"cash": 123,
"credit_card": 123,
"bank_account": 123,
"other": 123,
"total_collected": 123
},
"collections_by_account": [
{
"account_id": 123,
"account_name": "<string>",
"amount": 123
}
],
"transaction": {
"id": 123,
"record_state": {
"is_read_only": true,
"reason_code": "<string>"
},
"tenant_id": 123,
"batch_uuid": "<string>",
"customer_id": 123,
"account_id": 123,
"sale_id": 123,
"currency_id": 123,
"exchange_rate": 123,
"debit": "<string>",
"credit": "<string>",
"amount": "<string>",
"transaction_date": "2023-11-07T05:31:56Z",
"type": "<string>",
"payment_method": "<string>",
"description": "<string>",
"invoice_number": "<string>",
"is_installment": true,
"due_date": "<string>",
"installment_number": 123,
"total_installments": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"account": {
"id": 123,
"name": "<string>"
},
"currency": {
"id": 123,
"code": "<string>",
"symbol": "<string>",
"name": "<string>"
}
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"success": true,
"error_code": "RESOURCE_NOT_FOUND",
"message": "<string>",
"errors": null,
"data": null
}{
"success": false,
"error_code": "CUSTOMER_ERASED",
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": false,
"error_code": "SETUP_REQUIRED",
"message": "Complete the required setup steps to continue.",
"data": {
"next_step": "clinic_info"
}
}Correct the account or payment method of a sale collection
Send account_id, payment_method or both. A new account moves the collection and its paired
account-ledger row (same batch_uuid) in one database transaction, so the previous account’s balance
drops and the new account’s balance rises by the collection amount; a collection recorded without an
account gets its account-ledger row created. A new payment method is written to the collection and its
ledger row alike, which moves the amount between the sale’s payments buckets. Amount, date and invoice
number never change. Only collections can be corrected, and the account must be active and use the
collection’s currency. The response carries the updated transaction and the sale’s payment figures
recomputed on the server.
curl --request PUT \
--url https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Tenant: <x-tenant>' \
--data '
{
"account_id": 123
}
'import requests
url = "https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}"
payload = { "account_id": 123 }
headers = {
"X-Tenant": "<x-tenant>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Tenant': '<x-tenant>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({account_id: 123})
};
fetch('https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}",
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([
'account_id' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Tenant: <x-tenant>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}"
payload := strings.NewReader("{\n \"account_id\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Tenant", "<x-tenant>")
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.put("https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}")
.header("X-Tenant", "<x-tenant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.flextell.ai/api/v1/sales/{id}/transactions/{transactionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Tenant"] = '<x-tenant>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": "<string>",
"data": {
"sale_id": "<string>",
"remaining_balance": "<string>",
"payments": {
"cash": 123,
"credit_card": 123,
"bank_account": 123,
"other": 123,
"total_collected": 123
},
"collections_by_account": [
{
"account_id": 123,
"account_name": "<string>",
"amount": 123
}
],
"transaction": {
"id": 123,
"record_state": {
"is_read_only": true,
"reason_code": "<string>"
},
"tenant_id": 123,
"batch_uuid": "<string>",
"customer_id": 123,
"account_id": 123,
"sale_id": 123,
"currency_id": 123,
"exchange_rate": 123,
"debit": "<string>",
"credit": "<string>",
"amount": "<string>",
"transaction_date": "2023-11-07T05:31:56Z",
"type": "<string>",
"payment_method": "<string>",
"description": "<string>",
"invoice_number": "<string>",
"is_installment": true,
"due_date": "<string>",
"installment_number": 123,
"total_installments": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"account": {
"id": 123,
"name": "<string>"
},
"currency": {
"id": 123,
"code": "<string>",
"symbol": "<string>",
"name": "<string>"
}
}
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"success": true,
"error_code": "RESOURCE_NOT_FOUND",
"message": "<string>",
"errors": null,
"data": null
}{
"success": false,
"error_code": "CUSTOMER_ERASED",
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"success": false,
"error_code": "SETUP_REQUIRED",
"message": "Complete the required setup steps to continue.",
"data": {
"next_step": "clinic_info"
}
}Yetkilendirmeler
The access token received from the authorization server in the OAuth 2.0 flow.
Başlıklar
Tenant identifier. Send the Tenant ID in the X-Tenant header to scope API requests to a specific tenant.
Yol Parametreleri
The sale identifier
The transaction identifier
Gövde
The account the collection was received into. Must be an active account of the tenant that uses the collection's currency. Required when payment_method is omitted.
The payment method the collection was received with. Required when account_id is omitted.
bank_account, cash, transfer_cash, other, clinic_credit_card, credit_card, private_insurance, sgk