Три способа подключиться. Касса: заведение проверяет QR со студенческой карты unio и отмечает, что скидка дана, — с телефона на /cashier или прямо из своей кассовой системы по этому API. Промокоды: студент берёт в unio личный код и вводит его у вас на сайте или в приложении, а ваш сервер сообщает о погашении — unio считает конверсии. «Войти через unio»: кнопка «Я студент» на сайте, OAuth 2.0 + PKCE.
Касса за минуту
В кабинете unio, раздел «Касса» — «Ключ API».
Сканер кассы читает QR студента — передай его содержимое как есть. Нет сканера — кассир набирает 9 цифр под QR.
POST /v1/pos/uses с Idempotency-Key — скидка отмечена, повтор после обрыва связи второй раз не запишется.
Студент берёт в unio личный код — «UN» и 8 знаков, живёт час — и вводит его у вас при заказе. Или unio раздаёт ваши коды: выгрузку из своей промо-системы загрузите в кабинете.
Покупатель нажал «Применить» — POST /v1/promo/check: давать ли скидку и что ему сказать.
Заказ оплачен — POST /v1/promo/redemptions: код сработал, конверсия засчитана. Повтор того же заказа второй раз не запишется.
Скопируйте промпт в Claude Code, Cursor, Codex или ChatGPT. Ассистент прочитает наши правила для ИИ и спецификацию, изучит ваш проект и сначала покажет план. Ключи он попросит у вас — не придумает.
Кнопка «Я студент» на сайте
Подключи к моему проекту студенческую скидку через unio — кнопку «Я студент» («Войти через unio», OAuth 2.0 + PKCE).
Сначала прочитай правила для ИИ https://unio.asia/developers/agent.md и спецификацию https://unio.asia/developers/openapi.yaml и следуй им, а не общим знаниям об OAuth.
Изучи проект: стек, где корзина или оформление заказа, как устроены пользователи и скидки. Потом покажи план: какие файлы изменишь, где появится кнопка, как сервер обменяет code на токены и проверит id_token, какие переменные окружения нужны.
client_id, client_secret и адрес возврата попроси у меня — не придумывай. Секреты — только в переменных окружения сервера. Скидку давай, только если student.verified = true.
Код не пиши, пока я не одобрю план.
Касса: QR студента
Подключи нашу кассовую систему к unio: кассир сканирует QR со студенческой карты unio (или вводит 9 цифр под QR), и касса отмечает, что студенческая скидка дана.
Сначала прочитай правила для ИИ https://unio.asia/developers/agent.md и спецификацию https://unio.asia/developers/openapi.yaml и следуй им.
Изучи, как у нас устроены чек, скидки и сканер, и покажи план. Обязательно: POST /v1/pos/uses с Idempotency-Key из номера чека; все ответы — ok, expired, used, not_student, other_company, offer_ended, unknown — с показом message кассиру; отмена погашения при возврате чека; сверка через GET /v1/pos/uses.
Ключ API (unio_sk_…) попроси у меня и храни только в настройках сервера.
Код не пиши, пока я не одобрю план.
Промокоды: онлайн-заказ
Подключи наш сайт (или приложение) к промокодам unio: студент вводит личный промокод unio при оформлении заказа, мы даём студенческую скидку и сообщаем unio о погашении — так unio считает конверсии.
Сначала прочитай правила для ИИ https://unio.asia/developers/agent.md (раздел 2a), инструкцию https://unio.asia/developers/promo.md и спецификацию https://unio.asia/developers/openapi.yaml (раздел «Промокоды») и следуй им.
Изучи, как у нас устроены корзина, промокоды и оплата, и покажи план. Обязательно: коды unio (UN и 8 знаков) — на POST /v1/promo/check, покупателю — customer_message, скидка только при result = ok; после оплаты — POST /v1/promo/redemptions с order_id и суммой, при сбое связи — повтор того же запроса; отмена при возврате заказа; сверка через GET /v1/promo/redemptions.
Ключ API (unio_sk_…) попроси у меня и храни только в настройках сервера.
Код не пиши, пока я не одобрю план.
Проверка готовой интеграции
Проверь нашу интеграцию с unio по правилам https://unio.asia/developers/agent.md и спецификации https://unio.asia/developers/openapi.yaml.
Пройди по чек-листу «Definition of done» из правил и выпиши всё, что не так, с файлами и строками: секреты в браузере, репозитории или логах; нет Idempotency-Key; не обработаны ответы; id_token не проверяется на сервере; хранятся лишние данные о студенте.
Сначала отчёт — правки только после моего согласия.
Prompts in English
“I’m a student” button on a website
Add a student discount via unio to my project — the “Я студент” button (Sign in with unio, OAuth 2.0 + PKCE).
First read the AI rules at https://unio.asia/developers/agent.md and the spec at https://unio.asia/developers/openapi.yaml, and follow them over your general OAuth knowledge.
Study the project: stack, where the cart or checkout is, how users and discounts work. Then show me a plan: files you will change, where the button goes, how the server exchanges the code and verifies the id_token, which environment variables are needed.
Ask me for client_id, client_secret and the redirect URI — do not invent them. Secrets live only in server environment variables. Grant the discount only when student.verified is true.
Do not write code until I approve the plan.
Till: student QR
Connect our POS to unio: the cashier scans the QR from the student’s unio card (or types the 9 digits under it), and the till records that the student discount was given.
First read the AI rules at https://unio.asia/developers/agent.md and the spec at https://unio.asia/developers/openapi.yaml, and follow them.
Study how our receipts, discounts and scanner work, then show me a plan. Required: POST /v1/pos/uses with an Idempotency-Key derived from the receipt number; handle every result — ok, expired, used, not_student, other_company, offer_ended, unknown — and show the message to the cashier; cancel the redemption on refund; reconcile via GET /v1/pos/uses.
Ask me for the API key (unio_sk_…) and keep it only in server settings.
Do not write code until I approve the plan.
Promo codes: online checkout
Connect our website (or app) to unio promo codes: a student types a personal unio promo code at checkout, we give the student discount and report the redemption to unio — that is how unio counts conversions.
First read the AI rules at https://unio.asia/developers/agent.md (section 2a), the guide at https://unio.asia/developers/promo.md and the spec at https://unio.asia/developers/openapi.yaml (tag “Промокоды”), and follow them.
Study how our cart, promo codes and payments work, then show me a plan. Required: route unio codes (UN + 8 characters) to POST /v1/promo/check, show customer_message to the buyer and apply the discount only when result = ok; after payment call POST /v1/promo/redemptions with order_id and amount, retrying the identical request on network errors; cancel on refund; reconcile via GET /v1/promo/redemptions.
Ask me for the API key (unio_sk_…) and keep it only in server settings.
Do not write code until I approve the plan.
Review an existing integration
Review our unio integration against the rules at https://unio.asia/developers/agent.md and the spec at https://unio.asia/developers/openapi.yaml.
Go through the “Definition of done” checklist in the rules and list everything that is wrong, with files and lines: secrets in the browser, repo or logs; missing Idempotency-Key; unhandled results; id_token not verified on the server; extra student data stored.
Report first — change code only after I agree.