Your own site with PayBot payments
You write a static site (HTML, CSS, JS, images, fonts). PayBot hosts it at https://<name>.paybot.kz, takes the payments through Kaspi, keeps the customers and the statistics. Nothing here needs a build step or a server of your own. Anything the merchant sells (a product, a course, a paid Telegram channel, a payment page) is created with the other tools first; the site only has buttons that open its checkout.
The loop#
- Create what is sold:
product_create+products_publish,course_create+course_page_deploy,channel_plan_deploy,payment_page_deploy. Read the handle or slug each returns: the buttons name it. - Write the site. Every page loads the SDK (below).
site_uploadwith the files (or a base64.zip). It is stored as a version, not public yet.site_publishwith theversion_id(the merchant may have to approve it in the cabinet: «Решения»; tell them).site_check: it opens the live site and proves that the files exist, every pay button points at something on sale and the lead form's endpoint answers. Fix what it lists, upload again, publish again.- Something wrong live?
site_rollbackwith an earlierversion_idfromsite_versions.
Limits: static files only (html, css, js, svg, png, jpg, webp, avif, gif, ico, woff, woff2, json, txt, webmanifest, map), at most 20 MiB and 2000 files, file names of letters, digits, . _ - /, index.html at the top (or inside one folder). No .php, no server code, no TypeScript sources: upload the built files. A larger archive goes through POST /v1/site/upload (raw .zip/.tar/.tar.gz body, header X-API-Key or Authorization: Bearer).
The SDK: one line#
<script src="/__pb/paybot.js" defer></script>It is served by the site itself, so it needs no address and no configuration: PayBot adds the business settings (window.__PAYBOT__) to every page. The security policy of an uploaded site allows its own scripts (also inline ones), Google Fonts, YouTube and Vimeo embeds, and calls to the PayBot API; nothing else. Do not load scripts from other hosts, they are blocked.
Pay button for a store product#
<button data-paybot-product="green-tea">Купить</button>
<button data-paybot-product="green-tea" data-qty="2" data-variant="green-tea-100g">Купить 2 по 100 г</button>green-tea is the product's handle (from product_create); data-variant is a variant's SKU. The click opens the PayBot checkout (/p/<site>/buy/<handle>), where the buyer pays with Kaspi. A product that is not on sale (products_publish not called) is refused by site_check.
Button for a course, a paid channel or a payment page / payment link#
<button data-paybot-page="my-course">Записаться</button>
<button data-paybot-page="vip-channel">Вступить в клуб</button>
<button data-paybot-page="consultation">Оплатить консультацию</button>data-paybot-page takes the slug of the page: the course page (course_page_deploy), the channel plan (channel_plan_deploy) or the payment page (payment_page_deploy). A page that is not published is refused by site_check.
Everything that is sold, as cards#
<div data-paybot-offers data-button="Купить"></div>The SDK reads the business's public offers and fills the container with .pb-offer cards (h3, .pb-price, button.pb-buy) that already work. Style those classes. Prices are shown as the server writes them (price_text); never write a price into the page yourself: change the price with variant_update and the site follows.
Lead form#
<form data-paybot-lead data-source="contact">
<input name="name" placeholder="Имя" required>
<input name="phone" placeholder="Телефон">
<input name="telegram" placeholder="Telegram">
<textarea name="message" placeholder="Сообщение"></textarea>
<label><input type="checkbox" name="consent" required> <span data-paybot-consent-text></span></label>
<button>Отправить</button>
</form>Needed: name, at least one of phone / telegram, and the consent checkbox with the consent text next to it (data-paybot-consent-text is filled by the SDK in the page's language: <html lang="ru|kk|en">; do not reword it). The lead lands in the merchant's «Клиенты». The form gets data-state = sending, sent or error (with data-error = invalid, rate_limited, captcha, unavailable, failed) and fires the events paybot:lead-sent and paybot:lead-error: show the result with CSS (form[data-state=sent] …) or a listener.
UTM and the source of the money#
Nothing to write. The SDK remembers utm_source, utm_medium, utm_campaign, utm_term, utm_content and ref from the address the visitor arrived with (the first visit wins for 30 days) and adds them to every checkout link, so the cabinet's statistics show where buyers came from. Advertise the site with such links: https://<name>.paybot.kz/?utm_source=instagram&utm_campaign=may.
For custom code#
window.PayBot has productUrl(handle, {qty, variant}), pageUrl(slug) (the checkout addresses, null when invalid), checkout(handle, opts), open(slug), offers() (a Promise of the offers), submitLead({name, phone, telegram, message, consent, source}) (a Promise; rejects with an Error whose .code is as above), utm() and consentText(lang). The raw script is the resource paybot://sdk/paybot.js.
Do not#
- Put prices, payment links, Kaspi data or bot tokens in the page. The SDK and PayBot supply them.
- Build your own payment form or take card or phone data for payment: payment happens only on the PayBot checkout.
- Collect personal data without the consent checkbox.
- Upload
.php, source maps with secrets,.env, node_modules: they are refused or useless.