curl --request POST \
--url https://app.zenedu.io/api/v1/payment-systems \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"type": "<string>",
"public_name": "<string>",
"settings": {
"manualTextRequisites": [
{
"name": "<string>",
"value": "<string>"
}
],
"bot_only": true
},
"attach_to_all_offers": false
}
'import requests
url = "https://app.zenedu.io/api/v1/payment-systems"
payload = {
"name": "<string>",
"type": "<string>",
"public_name": "<string>",
"settings": {
"manualTextRequisites": [
{
"name": "<string>",
"value": "<string>"
}
],
"bot_only": True
},
"attach_to_all_offers": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
type: '<string>',
public_name: '<string>',
settings: {manualTextRequisites: [{name: '<string>', value: '<string>'}], bot_only: true},
attach_to_all_offers: false
})
};
fetch('https://app.zenedu.io/api/v1/payment-systems', 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.zenedu.io/api/v1/payment-systems",
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([
'name' => '<string>',
'type' => '<string>',
'public_name' => '<string>',
'settings' => [
'manualTextRequisites' => [
[
'name' => '<string>',
'value' => '<string>'
]
],
'bot_only' => true
],
'attach_to_all_offers' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.zenedu.io/api/v1/payment-systems"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"public_name\": \"<string>\",\n \"settings\": {\n \"manualTextRequisites\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"bot_only\": true\n },\n \"attach_to_all_offers\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://app.zenedu.io/api/v1/payment-systems")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"public_name\": \"<string>\",\n \"settings\": {\n \"manualTextRequisites\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"bot_only\": true\n },\n \"attach_to_all_offers\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.zenedu.io/api/v1/payment-systems")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"public_name\": \"<string>\",\n \"settings\": {\n \"manualTextRequisites\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"bot_only\": true\n },\n \"attach_to_all_offers\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "<string>",
"public_name": "<string>",
"type": "<string>",
"type_name": "<string>",
"supports_subscription": true,
"sort": 123,
"settings": {},
"credentials_set": true,
"created_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Создать способ оплаты
Создаёт способ оплаты в аккаунте
curl --request POST \
--url https://app.zenedu.io/api/v1/payment-systems \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"type": "<string>",
"public_name": "<string>",
"settings": {
"manualTextRequisites": [
{
"name": "<string>",
"value": "<string>"
}
],
"bot_only": true
},
"attach_to_all_offers": false
}
'import requests
url = "https://app.zenedu.io/api/v1/payment-systems"
payload = {
"name": "<string>",
"type": "<string>",
"public_name": "<string>",
"settings": {
"manualTextRequisites": [
{
"name": "<string>",
"value": "<string>"
}
],
"bot_only": True
},
"attach_to_all_offers": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
type: '<string>',
public_name: '<string>',
settings: {manualTextRequisites: [{name: '<string>', value: '<string>'}], bot_only: true},
attach_to_all_offers: false
})
};
fetch('https://app.zenedu.io/api/v1/payment-systems', 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.zenedu.io/api/v1/payment-systems",
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([
'name' => '<string>',
'type' => '<string>',
'public_name' => '<string>',
'settings' => [
'manualTextRequisites' => [
[
'name' => '<string>',
'value' => '<string>'
]
],
'bot_only' => true
],
'attach_to_all_offers' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.zenedu.io/api/v1/payment-systems"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"public_name\": \"<string>\",\n \"settings\": {\n \"manualTextRequisites\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"bot_only\": true\n },\n \"attach_to_all_offers\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://app.zenedu.io/api/v1/payment-systems")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"public_name\": \"<string>\",\n \"settings\": {\n \"manualTextRequisites\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"bot_only\": true\n },\n \"attach_to_all_offers\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.zenedu.io/api/v1/payment-systems")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"type\": \"<string>\",\n \"public_name\": \"<string>\",\n \"settings\": {\n \"manualTextRequisites\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"bot_only\": true\n },\n \"attach_to_all_offers\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "<string>",
"public_name": "<string>",
"type": "<string>",
"type_name": "<string>",
"supports_subscription": true,
"sort": 123,
"settings": {},
"credentials_set": true,
"created_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}type.
- Ключи
settingsзависят отtype, см. таблицу в полеsettings. Неизвестные ключи отбрасываются, у текстовых значений обрезаются пробелы. nameдолжен быть уникальным в аккаунте без учёта регистра.- В аккаунте может быть только один способ оплаты
telegramstars: на второй вернётся409. - Для
manuallyу реквизитов обязательныnameиvalue, а итоговое сообщение бота должно уложиться в 4000 символов. attach_to_all_offersдобавляет способ оплаты во все тарифы, чью валюту и минимальную сумму он поддерживает.
stripe перед сохранением в Stripe регистрируется вебхук с переданным secret_key. Если Stripe отклоняет ключ, ничего не сохраняется и возвращается 422 с ошибкой в settings.secret_key.Авторизации
API token from the Zenedu dashboard
Тело
Internal name, unique within the account (case-insensitive)
255Payment method type, see List payment method types
Name shown to subscribers; empty or null shows the type name
255Settings for the payment method type. Allowed keys depend on type — see List payment method types. Unknown keys are dropped, text values are trimmed, and every credential key of the type is required.
| Type | Keys |
|---|---|
wayforpay | domain, seller_id, seller_secret |
fondy | merchant_id, secret_key |
monobank | api_token |
paypal | client_id, client_secret, webhook_id |
stripe | secret_key |
mollie | api_key |
nowpayments | api_key, ipn_secret_key |
whitepay | api_key, slug, webhook_token |
liqpay | public_key, private_key |
telegramstars | bot_only (boolean, defaults to true on create) |
manually | manualIcon, manualTextIntro, manualTextIntroShop, manualTextRequisites, manualTextPaymentProof, manualTextPaymentDone, manualTextButton, manualAppWaitingHeading, manualAppWaitingText, manualAppWaitingButton |
For manually, every text key except manualIcon and manualTextIntroShop is required, and manualTextRequisites must contain at least one row with both name and value filled. The resulting bot message must fit into 4000 characters.
Show child attributes
Show child attributes
Attach the new method to every offer whose currency and minimum amount it supports
Ответ
Payment method created
Show child attributes
Show child attributes