Receive Subscription Event
curl --request POST \
--url https://api.example.com/notifications/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"user_id": 2,
"subscription_id": 2,
"transaction_id": 2,
"amount_kopeks": 1,
"currency": "<string>",
"message": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"extra": {}
}
'import requests
url = "https://api.example.com/notifications/subscriptions"
payload = {
"user_id": 2,
"subscription_id": 2,
"transaction_id": 2,
"amount_kopeks": 1,
"currency": "<string>",
"message": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"extra": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 2,
subscription_id: 2,
transaction_id: 2,
amount_kopeks: 1,
currency: '<string>',
message: '<string>',
occurred_at: '2023-11-07T05:31:56Z',
extra: {}
})
};
fetch('https://api.example.com/notifications/subscriptions', 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://api.example.com/notifications/subscriptions",
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([
'user_id' => 2,
'subscription_id' => 2,
'transaction_id' => 2,
'amount_kopeks' => 1,
'currency' => '<string>',
'message' => '<string>',
'occurred_at' => '2023-11-07T05:31:56Z',
'extra' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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 := "https://api.example.com/notifications/subscriptions"
payload := strings.NewReader("{\n \"user_id\": 2,\n \"subscription_id\": 2,\n \"transaction_id\": 2,\n \"amount_kopeks\": 1,\n \"currency\": \"<string>\",\n \"message\": \"<string>\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"extra\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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("https://api.example.com/notifications/subscriptions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": 2,\n \"subscription_id\": 2,\n \"transaction_id\": 2,\n \"amount_kopeks\": 1,\n \"currency\": \"<string>\",\n \"message\": \"<string>\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"extra\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/notifications/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": 2,\n \"subscription_id\": 2,\n \"transaction_id\": 2,\n \"amount_kopeks\": 1,\n \"currency\": \"<string>\",\n \"message\": \"<string>\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"extra\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"event_type": "<string>",
"user_id": 123,
"user_full_name": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"user_username": "<string>",
"user_telegram_id": 123,
"subscription_id": 123,
"transaction_id": 123,
"amount_kopeks": 123,
"currency": "<string>",
"message": "<string>",
"extra": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}notifications
Receive Subscription Event
Приём уведомления о событии подписки (webhook).
POST
/
notifications
/
subscriptions
Receive Subscription Event
curl --request POST \
--url https://api.example.com/notifications/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"user_id": 2,
"subscription_id": 2,
"transaction_id": 2,
"amount_kopeks": 1,
"currency": "<string>",
"message": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"extra": {}
}
'import requests
url = "https://api.example.com/notifications/subscriptions"
payload = {
"user_id": 2,
"subscription_id": 2,
"transaction_id": 2,
"amount_kopeks": 1,
"currency": "<string>",
"message": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"extra": {}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 2,
subscription_id: 2,
transaction_id: 2,
amount_kopeks: 1,
currency: '<string>',
message: '<string>',
occurred_at: '2023-11-07T05:31:56Z',
extra: {}
})
};
fetch('https://api.example.com/notifications/subscriptions', 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://api.example.com/notifications/subscriptions",
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([
'user_id' => 2,
'subscription_id' => 2,
'transaction_id' => 2,
'amount_kopeks' => 1,
'currency' => '<string>',
'message' => '<string>',
'occurred_at' => '2023-11-07T05:31:56Z',
'extra' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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 := "https://api.example.com/notifications/subscriptions"
payload := strings.NewReader("{\n \"user_id\": 2,\n \"subscription_id\": 2,\n \"transaction_id\": 2,\n \"amount_kopeks\": 1,\n \"currency\": \"<string>\",\n \"message\": \"<string>\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"extra\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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("https://api.example.com/notifications/subscriptions")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": 2,\n \"subscription_id\": 2,\n \"transaction_id\": 2,\n \"amount_kopeks\": 1,\n \"currency\": \"<string>\",\n \"message\": \"<string>\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"extra\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/notifications/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": 2,\n \"subscription_id\": 2,\n \"transaction_id\": 2,\n \"amount_kopeks\": 1,\n \"currency\": \"<string>\",\n \"message\": \"<string>\",\n \"occurred_at\": \"2023-11-07T05:31:56Z\",\n \"extra\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"event_type": "<string>",
"user_id": 123,
"user_full_name": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"user_username": "<string>",
"user_telegram_id": 123,
"subscription_id": 123,
"transaction_id": 123,
"amount_kopeks": 123,
"currency": "<string>",
"message": "<string>",
"extra": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
application/json
Available options:
activation, purchase, renewal, balance_topup, promocode_activation, referral_link_visit, promo_group_change Required range:
x >= 1Required range:
x >= 1Required range:
x >= 1Required range:
x >= 0Required string length:
1 - 16Maximum string length:
2000Response
Successful Response
⌘I
