Skip to main content
POST
/
api
/
transaction
Create transaction with signature verification
curl --request POST \
  --url http://localhost:4000/api/transaction \
  --header 'Content-Type: application/json' \
  --header 'x-signature: <api-key>' \
  --data '
{
  "project_uid": "<string>",
  "amount": "10.50",
  "currency": "TON",
  "success_url": "<string>",
  "failed_url": "<string>",
  "callback_url": "<string>",
  "tx_hash": "<string>"
}
'
import requests

url = "http://localhost:4000/api/transaction"

payload = {
"project_uid": "<string>",
"amount": "10.50",
"currency": "TON",
"success_url": "<string>",
"failed_url": "<string>",
"callback_url": "<string>",
"tx_hash": "<string>"
}
headers = {
"x-signature": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {'x-signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_uid: '<string>',
amount: '10.50',
currency: 'TON',
success_url: '<string>',
failed_url: '<string>',
callback_url: '<string>',
tx_hash: '<string>'
})
};

fetch('http://localhost:4000/api/transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_PORT => "4000",
CURLOPT_URL => "http://localhost:4000/api/transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_uid' => '<string>',
'amount' => '10.50',
'currency' => 'TON',
'success_url' => '<string>',
'failed_url' => '<string>',
'callback_url' => '<string>',
'tx_hash' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-signature: <api-key>"
],
]);

$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 := "http://localhost:4000/api/transaction"

payload := strings.NewReader("{\n \"project_uid\": \"<string>\",\n \"amount\": \"10.50\",\n \"currency\": \"TON\",\n \"success_url\": \"<string>\",\n \"failed_url\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"tx_hash\": \"<string>\"\n}")

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

req.Header.Add("x-signature", "<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))

}
HttpResponse<String> response = Unirest.post("http://localhost:4000/api/transaction")
.header("x-signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"project_uid\": \"<string>\",\n \"amount\": \"10.50\",\n \"currency\": \"TON\",\n \"success_url\": \"<string>\",\n \"failed_url\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"tx_hash\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:4000/api/transaction")

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

request = Net::HTTP::Post.new(url)
request["x-signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_uid\": \"<string>\",\n \"amount\": \"10.50\",\n \"currency\": \"TON\",\n \"success_url\": \"<string>\",\n \"failed_url\": \"<string>\",\n \"callback_url\": \"<string>\",\n \"tx_hash\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "ok",
  "tx": {
    "id": "1712580000_3cc034f2d8fe41f48c9f9da0d6f6f2a1",
    "amount": "10.50",
    "currency_symbol": "<string>",
    "event_timestamp": 1712580000,
    "expiration_time": "2023-11-07T05:31:56Z",
    "tx_hash": "<string>",
    "wallet_address": "<string>",
    "network_id": 123,
    "from_address": "<string>"
  },
  "frontend_link": "<string>"
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}

Authorizations

x-signature
string
header
required

HMAC signature used by POST /api/transaction

Headers

x-signature
string
required

Lowercase hex HMAC-SHA256 of the raw body

Body

application/json
project_uid
string
required

Public project UUID; the backend also attempts internal-id fallback

amount
required

Decimal amount accepted by the backend

Example:

"10.50"

currency
string
required
Example:

"TON"

success_url
string<uri>
required
failed_url
string<uri>
required
callback_url
string<uri>
required
tx_hash
string | null

Optional external transaction hash override

Response

Transaction created

status
enum<string>
required
Available options:
ok
tx
object
required