Оплата
Тариф, оплата по факту, счета и ссылки для оплаты.
Инструменты оплаты
| Инструмент | Что делает |
|---|---|
| getBilling | Тариф рабочего пространства и то, что в него входит, как его показывает раздел «Тарифы и оплата»: как он оплачивается, когда продлевается или заканчивается и следующий платёж, домены, отправки за этот месяц, ИИ-действия за сегодня и оплата по факту. |
| listBillingPlans | Каждый тариф, от самого дешёвого, с ценой, местом продажи и тем, что в него входит. |
| getBillingUsage | Отправки и ИИ-действия по дням и стоимость сверхлимитного использования оплаты по факту по месяцам, как их показывают графики использования. days уходит назад до 3660 дней, а all до дня, когда было создано рабочее пространство. |
| listBillingAlerts | Что сейчас сказал бы баннер оплаты в приложении, самое срочное первым. |
| listBillingCountries | Каждый код страны, который принимает платёжный адрес. |
| getPayAsYouGo | Оплата по факту: выставляется ли сверхлимитное использование, месячный лимит и сколько оно стоит на сейчас, текущий период, лимиты, которые можно выбрать, и цены. |
| setPayAsYouGo | Включить или выключить оплату по факту. В первый раз он возвращает ссылку, по которой человек добавляет карту. В чате приложения он всегда сначала спрашивает. |
| setPayAsYouGoLimit | Задать месячный лимит оплаты по факту. В чате приложения он всегда сначала спрашивает. |
| confirmPayAsYouGo | Когда человек добавил карту, проверить, что она сохранена, и записать это. В чате приложения он всегда сначала спрашивает. |
| startPlanCheckout | Ссылка на оплату платного тарифа для рабочего пространства на бесплатном тарифе. В чате приложения он всегда сначала спрашивает. |
| openBillingPortal | Ссылка на биллинг-портал, где тариф меняют или отменяют и обновляют карту. В чате приложения он всегда сначала спрашивает. |
| listInvoices | Каждый платёж с состоянием его счёта, как их показывает История в разделе «Тарифы и оплата», постранично. |
| getInvoice | Ссылка на счёт по одному платежу, PDF, ведь инструмент не передаёт файлов. |
| saveBillingDetails | Сохранить имя и адрес в счёте платежа, оставить адрес для следующих платежей и начать формировать его счёт. В чате приложения он всегда сначала спрашивает. |
К оплате есть доступ только у владельца рабочего пространства, через клиент, подключённый со всеми адресами. Для чтения нужна billing:read, а для каждого изменения нужна billing:write.
Через инструмент ничего не оплачивается. Оплата, биллинг-портал и добавление карты для оплаты по факту возвращают ссылку, которую человек открывает, и уже там он платит, меняет карту или отменяет.
Некоторые инструменты этого сервера вносят изменение, которое REST API защищает кодом подтверждения, и спрашивают тот же код. Пока клиент не подтвердил код за последние 60 минут и человек не выбрал для него «Разрешить изменения на 60 минут» в разделе «Аккаунт → Подключённые приложения», такой инструмент отвечает результатом, который начинается с Refused (step_up_required):, и ничего не меняет. emptyAudience никогда не спрашивает код. Страница «Аутентификация» в API перечисляет все инструменты, которые спрашивают код, и показывает, как запросить код и подтвердить его.
Справочник
getBilling
The plan of this workspace and what it includes, as Plans & Billing shows it: how it is billed, when it renews or ends and the next charge, how many domains it holds, how much of this month's sends and today's AI actions are used, and pay as you go. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
Не принимает входных данных.
Также доступно в
listBillingPlans
Every plan, cheapest first, with its price, whether it is sold here and at which intervals, and what it includes. Prices are in US dollars. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
Не принимает входных данных.
Также доступно в
getBillingUsage
Sends and AI actions per day, and what pay as you go extras cost per month, as the Usage charts show them. days goes back 1 to 3660 days, 30 by default, and "all" goes back to the day the workspace was made. Days with no use are left out. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
daysinteger | string
Также доступно в
listBillingAlerts
What the billing banner of the app would say now, most urgent first: a failed payment, paused pay as you go, sending or AI paused at a limit, a plan about to end, an allowance nearly used and a charge coming soon. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
Не принимает входных данных.
Также доступно в
listBillingCountries
Every country a billing address can be in, as the two-letter ISO 3166 codes saveBillingDetails takes as country. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
Не принимает входных данных.
Также доступно в
getPayAsYouGo
Pay as you go on this workspace: whether usage past the allowances is billed, the monthly limit and what extras cost so far, the current billing period, the limits that can be chosen and the prices. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
Не принимает входных данных.
Также доступно в
setPayAsYouGo
Turn pay as you go on or off, as the switch on Plans & Billing does. Off takes effect at once, and usage stops at the plan's allowances. On takes effect at once when a card is saved. The first time, it returns a link where the person adds a card on the billing provider's page: give them the link, and call confirmPayAsYouGo once they say they are done. Nothing is paid through this tool. It asks for a verification code, and in the app's chat it always asks first. Only the owner of the workspace reaches billing, through a client connected with every address.
- Запрашивает код подтверждения
PATCH /billing/pay-as-you-go
Входные данные
enabledbooleanОбязательноthemestringLight or dark, for the page the link opens. Left out, it follows the browser.
Одно из"light""dark"localestringA language tag such as de or pt-PT, for the page the link opens.
До 35 символов
Также доступно в
setPayAsYouGoLimit
Set the monthly spending limit of pay as you go, in US cents. Extras stop for the rest of a calendar month once it is reached. Pay as you go has to be set up first. It asks for a verification code, and in the app's chat it always asks first. Only the owner of the workspace reaches billing, through a client connected with every address.
- Запрашивает код подтверждения
PUT /billing/pay-as-you-go/limit
Входные данные
limitCentsintegerОбязательноOne of 1000, 2500, 5000, 10000, 25000, 50000, 100000, 250000, 500000.
Также доступно в
confirmPayAsYouGo
After the person added a card through the link setPayAsYouGo gave, check with the billing provider that it was saved and record it, as the app does when they come back. It asks for a verification code, and in the app's chat it always asks first. Only the owner of the workspace reaches billing, through a client connected with every address.
- Запрашивает код подтверждения
POST /billing/pay-as-you-go/confirm
Входные данные
Не принимает входных данных.
Также доступно в
startPlanCheckout
Start buying a paid plan for a workspace on Free, as choosing a plan in the app does, and return the link to the checkout on the billing provider's page. Nothing is charged until the person pays there, so give them the link. A workspace that already pays for a plan changes it with openBillingPortal instead. interval is month or year, month by default. It asks for a verification code, and in the app's chat it always asks first. Only the owner of the workspace reaches billing, through a client connected with every address.
- Запрашивает код подтверждения
POST /billing/checkout
Входные данные
planstringОбязательно- Одно из
"starter""business""enterprise" intervalstring- Одно из
"month""year" themestringLight or dark, for the page the link opens. Left out, it follows the browser.
Одно из"light""dark"localestringA language tag such as de or pt-PT, for the page the link opens.
До 35 символов
Также доступно в
openBillingPortal
A link to the billing portal, where the person changes or cancels the plan, updates the card and downloads past invoices, as Manage does in the app. Nothing changes until they act there. It asks for a verification code, and in the app's chat it always asks first. Only the owner of the workspace reaches billing, through a client connected with every address.
- Запрашивает код подтверждения
POST /billing/portal
Входные данные
themestringLight or dark, for the page the link opens. Left out, it follows the browser.
Одно из"light""dark"localestringA language tag such as de or pt-PT, for the page the link opens.
До 35 символов
Также доступно в
listInvoices
Every charge of the workspace with the state of its invoice, as History on Plans & Billing lists them, newest first unless sort is oldest. search matches the plan, the invoice number, the charge id and the name billed. getInvoice returns the link to an invoice. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
pageinteger- Не меньше 1
limitinteger- Не меньше 1Не больше 100
sortstring- Одно из
"newest""oldest" searchstring- До 120 символов
Также доступно в
getInvoice
The link to the invoice of one charge, a PDF, since a tool carries no file. An invoice that was not written yet is written first, which takes a few seconds. Take the charge id from listInvoices. Only the owner of the workspace reaches billing, through a client connected with every address.
Входные данные
orderIdstringОбязательно- Не пустое
Также доступно в
saveBillingDetails
Save the name and address billed on a charge, as the Billing address dialog does, keep the address for later charges, and start writing its invoice. country is a two-letter code from listBillingCountries, and in the US and Canada state is its two-letter code. It asks for a verification code, and in the app's chat it always asks first. Only the owner of the workspace reaches billing, through a client connected with every address.
- Запрашивает код подтверждения
PUT /billing/invoices/{orderId}/details
Входные данные
orderIdstringОбязательно- Не пустое
namestringОбязательно- От 1 до 200 символов
line1stringОбязательно- От 1 до 200 символов
line2string- До 200 символов
citystringОбязательно- От 1 до 120 символов
postalCodestring- До 40 символов
statestring- До 60 символов
countrystringОбязательно- Одно из
"AD""AE""AF""AG""AI""AL""AM""AO""AQ""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BV""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GS""GT""GU""GW""GY""HK""HM""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PN""PR""PS""PT""PW""PY""QA""RE""RO""RS""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SZ""TC""TD""TF""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""UM""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""YE""YT""ZA""ZM""ZW"