# Calio API (version 2026-10-18) > Generated from the same source the server enforces (spec/openapi.json, errorCatalog.json, events.json). Language: Hebrew text, English identifiers. > Base URL: https://api.calio-app.com/v1 — the same for test and live; the key decides (calio_sk_test_… / calio_sk_live_…). Postman collection: postman_collection.json (same folder). ## מה אפשר לעשות עם ה-API ה-API של קאליו לאתרים חיצוניים: דפי תשלום, קטלוג ומלאי, מנויים, לקוחות ומסמכים. כל קריאה היא שרת-מול-שרת עם מפתח סודי. - דף תשלום של קאליו לעגלה מהאתר — המחיר נלקח מהקטלוג בשרת, לא ממה שהגולש שולח. כל תשלום נרשם כעסקה עם קבלה ומוריד מלאי. - קטלוג ומלאי: מוצרים, שירותים, וריאציות ומלאי לפי מידה — לקריאה, כדי שהאתר יציג בדיוק את מה שבאפליקציה. - מנויים: חיוב חוזר שבועי / חודשי / שנתי. הלקוח מזין כרטיס בדף של קאליו; כל חיוב — עסקה עם קבלה. - לקוחות: אותו כרטיס לקוח כמו באפליקציה של העסק. - מסמכים: קריאה של קבלות וחשבוניות של תשלומים שעברו דרכנו, ו-PDF בקישור חתום. - Webhooks: קאליו מודיעה לשרת של האתר על כל שינוי — חתום, עם ניסיונות חוזרים. > כל קריאה היא שרת-מול-שרת עם מפתח סודי. לעולם לא מקוד שרץ אצל הגולש ולא מאפליקציה בטלפון — מפתח שנשלח משם נחסם (secret_key_from_browser). ## התחלה מהירה — תשלום ראשון ב-5 צעדים - מקבלים מפתח בדיקה: בעל העסק יוצר אותו באפליקציה (הגדרות ← חיבור לאתר (API) ← מפתחות ← מפתח בדיקה), או שקאליו שולחת לכם אותו. - בעל העסק מוסיף את הדומיין של האתר תחת "דומיינים והגדרות תשלום" (אחרת כתובת החזרה תידחה). - יוצרים דף תשלום (POST /v1/checkout_sessions) ומפנים את הקונה ל-url שחזר. - הקונה משלם בכרטיס בדיקה — במצב בדיקה כל חיוב הוא ₪2 בדיוק, בלי עסקה ובלי מסמך אמיתי. - מקבלים payment.succeeded ב-webhook, מאמתים את החתימה — ורק אז שולחים את הסחורה / פותחים את השירות. ```bash curl -X POST https://api.calio-app.com/v1/checkout_sessions \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "lines": [ { "product_id": "prd_shirt1", "quantity": 2, "variant": { "מידה": "M" } }, { "name": "דמי משלוח", "quantity": 1, "unit_price_agorot": 2500 } ], "customer": { "name": "דנה כהן", "phone": "0501234567", "email": "dana@example.co.il" }, "reference": "ORDER-1042", "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart" }' ``` > החזרה של הקונה לאתר (success_url) אינה הוכחה לתשלום — היא רק נוחות. ההוכחה היא אירוע payment.succeeded חתום, או GET /v1/payments/{id}. ## אימות ומפתחות כל בקשה נושאת את המפתח בכותרת Authorization: ```http Authorization: Bearer calio_sk_test_… ``` - calio_sk_test_… — מצב בדיקה. calio_sk_live_… — תשלומים אמיתיים (נוצר רק אחרי התחברות מחדש של בעל העסק, והוא מקבל התראה). - המפתח מוצג לבעל העסק פעם אחת. אם הלך לאיבוד — מבטלים ויוצרים חדש. עד 2 מפתחות פעילים מכל סוג (להחלפה בלי השבתה). - בעל העסק יכול לבטל מפתח, לעצור את כל החיבור, או לכבות את שליפת רשימת הלקוחות — מהאפליקציה, בכל רגע. - לפי בקשה, קאליו יכולה להגביל מפתח לכתובות IP מסוימות ולקבוע לו תאריך תפוגה. מפתח אמיתי שמופיע מכתובת חדשה מתריע לבעל העסק. - תשלומים חשודים שעברו (למשל הרבה תשלומים קטנים בכרטיסים שונים) משעים את כל המפתחות של העסק מיד, ומתריעים לבעל העסק ולקאליו. פתיחות חריגות של דפי תשלום רק מתריעות, כי כל מבקר יכול לייצר אותן. - קישור תשלום נחסם אחרי 10 פתיחות, ואחרי 5 כרטיסים שנדחו ברצף הקונה חוזר לדף הכישלון. #### יכולות (capabilities) | יכולת | מה מאפשרת | ברירת מחדל | |---|---|---| | account:read | פרטי החיבור | כן | | catalog:read | קריאת מוצרים ושירותים | כן | | checkout:write | יצירת דפי תשלום | כן | | checkout:read | קריאת דפי תשלום | כן | | payments:read | קריאת תשלומים | כן | | customers:read | קריאת לקוח וחיפוש | כן | | customers:list | רשימת כל הלקוחות | כן | | customers:write | יצירה ועדכון של לקוחות | כן | | subscriptions:read | קריאת מנויים | כן | | subscriptions:write | יצירה וניהול מנויים | כן | | subscriptions:amount | שינוי סכום מנוי | 🔴 רק אם בעל העסק הפעיל | | documents:read | קריאת מסמכים | כן | | events:read | קריאת אירועים | כן | | orders:read | קריאת הזמנות | כן | | orders:write | עדכון הזמנה ל"נשלחה" / "נמסרה" | כן | | orders:create_unpaid | הזמנות בלי תשלום (מזומן / תשלום באיסוף) | 🔴 רק אם בעל העסק הפעיל | ## מצב בדיקה - מפתח בדיקה עובד מול מסוף הבדיקה של קאליו — גם לפני שהעסק חיבר סליקה. - 🔴 כל חיוב במצב בדיקה הוא ₪2 בדיוק, לא משנה מה סכום העגלה. כרטיס אמיתי נדחה במסוף הבדיקה. - תשלום בדיקה לא יוצר עסקה, לקוח, מלאי או מסמך חשבונאי. המסמך שחוזר הוא test_receipt — בלי תוקף. - לקוחות ומנויים במצב בדיקה הם ארגז-חול נפרד — מפתח בדיקה לעולם לא רואה לקוח אמיתי של העסק. - מנויים במצב בדיקה: אין דף כרטיס — מפעילים ומדמים חיובים עם POST /v1/subscriptions/{id}/test/activate ו-…/test/charge. > פרטי כרטיסי הבדיקה יפורסמו כאן עם פתיחת מסוף הבדיקה. עד אז — בקשו אותם מקאליו. ## בקשות, עימוד וגרסאות - כתובת בסיס: https://api.calio-app.com. גוף JSON בלבד (Content-Type: application/json), עד 64KB. - כל בקשת כתיבה (POST / PATCH) חייבת Idempotency-Key ייחודי. אותה בקשה עם אותו מפתח ⇒ אותה תשובה בדיוק, בלי פעולה כפולה. אותו מפתח עם גוף אחר ⇒ 409 idempotency_key_reused. - שדה לא מוכר בבקשה ⇒ 400 unknown_parameter (כדי ששגיאת כתיב לא "תעבור בשקט"). - סכומים — תמיד באגורות שלמות (12900 = ₪129). - רשימות: limit (1–100), starting_after=; בתשובה has_more ו-next_cursor. - גרסה: Calio-Api-Version: 2026-10-18 (אופציונלי; בלי — הגרסה הנוכחית). כל תשובה מחזירה Calio-Request-Id — שלחו אותו לתמיכה. - מזהים: cs_ דף תשלום · pay_ תשלום · prd_ מוצר · cus_ לקוח · sub_ מנוי · doc_ מסמך · evt_ אירוע. - Postman: מייבאים את postman_collection.json (בראש העמוד), שמים מפתח בדיקה במשתנה secret_key ומריצים. מאפליקציית Postman למחשב — בקשה מגרסת הדפדפן של Postman נחסמת, כמו כל בקשה עם מפתח סודי מדפדפן. ## שגיאות כל שגיאה באותה מעטפה. code יציב — עליו בונים לוגיקה; message בעברית — אפשר להציג למשתמש; developer_message — לכם. ```json { "error": { "type": "invalid_request", "code": "product_out_of_stock", "message": "המוצר אזל מהמלאי", "developer_message": "prd_shirt1: requested 2, available 1", "param": "lines[0]", "retryable": false, "retry_after_seconds": null, "doc_url": "https://calio-app.com/developers/#error-product_out_of_stock", "request_id": "req_…" } } ``` | code | HTTP | לנסות שוב | הודעה | מתי | מה לעשות | |---|---|---|---|---|---| | invalid_api_key | 401 | לא | מפתח ה-API אינו תקין | The Authorization header is missing, malformed, or the key does not exist / the secret does not match. | Send 'Authorization: Bearer calio_sk_…'. Check you copied the whole key. | | api_key_revoked | 401 | לא | מפתח ה-API בוטל | The key was revoked by the business owner. | Create a new key in the Calio app (חיבור לאתר → מפתחות). | | api_key_expired | 401 | לא | תוקף מפתח ה-API פג | The key passed its expiry (rotation window ended, or unused for 180 days). | Create a new key in the Calio app. | | api_key_ip_not_allowed | 403 | לא | המפתח הזה לא מקבל בקשות מהכתובת הזו | The key has an IP list and this request came from another address. | Send it from an allowed server, or ask Calio to update the key's IP list. | | key_suspended_security | 403 | לא | מפתח ה-API הושעה מטעמי אבטחה | Calio's protection engine suspended the key (suspected abuse). | The business owner was notified. Reactivation is manual, from the Calio app, after review. | | capability_denied | 403 | לא | למפתח הזה אין הרשאה לפעולה | The key's capabilities do not include the one this endpoint requires. | The business owner can enable the capability for this key in the Calio app. | | secret_key_from_browser | 403 | לא | אין לשלוח את המפתח הסודי מהדפדפן | The request carried a browser Origin header — the secret key is being used from client-side code and is exposed to every visitor. | Move the call to your server and rotate the key immediately. | | auth_rate_limited | 429 | כן | יותר מדי ניסיונות התחברות. נסו שוב מאוחר יותר | Too many failed authentications from this IP. | Wait for Retry-After. Check the key you are sending. | | rate_limited | 429 | כן | יותר מדי בקשות. נסו שוב בעוד רגע | A per-key / per-business / platform request-rate limit was reached. | Retry after Retry-After seconds with the same Idempotency-Key. | | monthly_quota_exceeded | 429 | לא | הגעתם למכסת הבקשות החודשית | The business used its monthly API request quota. | The quota resets at the start of the month (Retry-After). Contact Calio to raise it. | | rate_limiter_unavailable | 503 | כן | השירות אינו זמין כרגע. נסו שוב בעוד רגע | The request-limit store is unreachable. Calio fails closed rather than unprotected. | Retry with backoff and the same Idempotency-Key. | | api_disabled | 403 | לא | החיבור לאתר אינו פעיל לעסק הזה | The API is switched off for this business (by the owner or by Calio). | The business owner can switch it on in the Calio app. | | api_unavailable | 503 | כן | השירות אינו זמין כרגע. נסו שוב בעוד רגע | The API is temporarily switched off platform-wide, or its configuration could not be read. | Retry with backoff. | | provider_not_supported_yet | 403 | לא | אמצעי הסליקה של העסק עדיין לא נתמך בחיבור לאתר | The business clears online payments with a provider the API does not support yet. | Contact Calio support. | | api_version_invalid | 400 | לא | גרסת ה-API אינה מוכרת | The Calio-Api-Version header names a version that does not exist. | Omit the header or send a version listed in the docs. | | invalid_json | 400 | לא | גוף הבקשה אינו JSON תקין | The request body could not be parsed as a JSON object. | Send a JSON object with Content-Type: application/json. | | unsupported_media_type | 415 | לא | סוג התוכן אינו נתמך | A request with a body was sent without Content-Type: application/json. | Set Content-Type: application/json. | | payload_too_large | 413 | לא | הבקשה גדולה מדי | The request body exceeds 64KB. | Reduce the number of lines or the metadata size. | | missing_parameter | 400 | לא | חסר שדה חובה בבקשה | A required field is missing. 'param' names it. | Add the field named in 'param'. | | invalid_parameter | 400 | לא | אחד השדות בבקשה אינו תקין | A field has the wrong type, format or range. 'param' names it, 'developer_message' says why. | Fix the field named in 'param'. | | unknown_parameter | 400 | לא | הבקשה כוללת שדה לא מוכר | The body contains a field the endpoint does not accept (typo, or a field from another endpoint). | Remove or rename the field named in 'param'. | | method_not_allowed | 405 | לא | הפעולה אינה נתמכת בכתובת הזו | The path exists but not with this HTTP method. | Check the method in the docs. | | route_not_found | 404 | לא | הכתובת אינה קיימת | No endpoint matches the path. | Check the path and the /v1 prefix. | | resource_not_found | 404 | לא | הפריט המבוקש לא נמצא | The id does not exist, or belongs to another business (Calio does not confirm which). | Check the id. | | idempotency_key_required | 400 | לא | חסרה כותרת Idempotency-Key | Every POST/PATCH must carry an Idempotency-Key header. | Send a unique Idempotency-Key (e.g. a UUID) per logical operation, and reuse it on retries. | | idempotency_key_invalid | 400 | לא | כותרת Idempotency-Key אינה תקינה | The key is empty, longer than 255 characters, or contains characters outside printable ASCII. | Use a UUID. | | idempotency_key_reused | 409 | לא | הבקשה כבר נשלחה עם תוכן אחר | The same Idempotency-Key was used with a different method, path or body within 24 hours. | Use a new Idempotency-Key for a new operation. | | idempotency_request_in_progress | 409 | כן | הבקשה עדיין בטיפול | A request with the same Idempotency-Key is still being processed. | Retry after Retry-After seconds with the same key; you will get the original response. | | internal_error | 500 | כן | אירעה שגיאה. נסו שוב בעוד רגע | An unexpected error on Calio's side. Nothing partial is committed for idempotent requests. | Retry with backoff and the same Idempotency-Key. If it persists, contact support with request_id. | | product_not_found | 422 | לא | המוצר המבוקש לא נמצא | product_id does not exist, was deleted, or the business hid it from the API. | Read GET /v1/products for current ids. | | product_unavailable | 422 | לא | המוצר אינו זמין כרגע | The product exists but is inactive, hidden, or has a price range instead of a single price. | Remove the line, or ask the business to activate the product. | | product_out_of_stock | 409 | לא | המוצר אזל מהמלאי | Requested quantity (summed across the cart per variant) exceeds the shelf. error.available holds the current stock. | Show the buyer the available quantity and let them change the cart. | | invalid_variant | 422 | לא | בחירת האפשרויות למוצר אינה תקינה | A required variant group is missing, an option does not exist or is sold out, or a group's min/max was violated. | Read the product's variant_groups and send a valid selection. | | invalid_quantity | 422 | לא | הכמות אינה תקינה | Quantity is outside the product's min/max or not a multiple of its step. error.min_quantity/max_quantity/step tell the rule. | Send a quantity that follows the rule. | | custom_lines_disabled | 403 | לא | העסק לא מאפשר שורות בסכום חופשי | A line without product_id was sent, but the business allows catalog products only. | Use catalog products, or ask the business to allow custom lines. | | price_changed | 409 | לא | המחיר השתנה | expected_total_agorot was sent and differs from the total computed from the current catalog. error.amount_total_agorot holds the current total. | Show the buyer the new total and send again with the new expected_total_agorot. | | amount_below_minimum | 422 | לא | הסכום נמוך מהמינימום לתשלום | The total is below the provider's minimum (₪1). | Raise the amount. | | amount_above_business_limit | 422 | לא | הסכום גבוה מהמותר לעסק בתשלום יחיד | The business set its own per-payment maximum in the app and the total exceeds it. | Split the payment, or ask the business to raise its limit. | | installments_not_allowed | 422 | לא | מספר התשלומים גבוה מהמותר לעסק | max_installments exceeds what the business allows (its setting and its plan). | Send a lower max_installments (error.allowed holds the maximum). | | url_domain_not_allowed | 422 | לא | כתובת החזרה אינה ברשימת הדומיינים של העסק | success_url / cancel_url is not https, or its domain is not in the business's allowed return domains. | Use an https URL on a domain the business added in the app (חיבור לאתר → דומיינים). | | business_cannot_accept_payments | 403 | לא | העסק אינו יכול לקבל תשלומים כרגע | The business has no active internet clearing terminal right now. Checked BEFORE the buyer sees a payment page. | The business owner was notified. Try again later. | | business_cannot_issue_documents | 403 | לא | העסק אינו יכול להפיק קבלות כרגע | The business is not connected to its documents provider. Checked BEFORE the buyer pays. | The business owner was notified. Try again later. | | plan_quota_reached | 403 | לא | העסק הגיע למכסת התשלומים במסלול | The business used the digital payments included in its plan this month. | The business owner was notified. | | checkout_session_not_open | 409 | לא | דף התשלום כבר אינו פתוח | Expire was requested for a session that is already paid, expired or canceled. | GET the session for its current status. | | checkout_session_in_payment | 409 | כן | הלקוח נמצא באמצע תשלום | Expire was requested while the buyer has the payment page open (last 3 minutes). | Retry after Retry-After, or let the session expire on its own. | | customer_not_found | 404 | לא | הלקוח לא נמצא | customer_id does not exist in this business. | Create the customer with POST /v1/customers, or send customer details inline. | | document_pdf_unavailable | 409 | כן | קובץ ה-PDF של המסמך עוד לא מוכן | The document exists but its PDF copy is not stored yet (it is copied a few seconds after issuing), or the file is missing. | Retry in a minute. The document data itself (GET /v1/documents/{id}) is available now. | | customer_exists | 409 | לא | כבר קיים לקוח עם הטלפון או המייל האלה | POST/PATCH with a phone or email that another customer card of the business already has. extra.customer_id names it. | Use the existing customer (extra.customer_id) — Calio never creates a silent duplicate or overwrites a card. | | customers_list_disabled | 403 | לא | בעל העסק כיבה את שליפת רשימת הלקוחות | The owner switched off reading the whole customer list. Exact search by phone/email still works. | Search by phone or email, or ask the business owner to switch the list on in the Calio app. | | customers_list_blocked | 403 | לא | שליפת רשימת הלקוחות נעצרה להגנת העסק | More than half of the customers were read in 24 hours — the pattern of a leaked key. The owner was alerted. | The business owner approves in the Calio app (חיבור לאתר) if it was a legitimate sync. | | subscription_invalid_state | 409 | לא | לא ניתן לבצע את הפעולה במצב הנוכחי של המנוי | For example pause on a subscription that is not active, resume on one that is not paused, or any change on a canceled / completed one. extra.status is the current public status. | GET the subscription and act on its current status. A past_due subscription needs a new card: POST …/payment_method_update_link. | | subscription_changed | 409 | כן | המנוי השתנה בזמן הפעולה | The subscription changed status between the read and the write (for example the engine charged it, or the business changed it in the app). | GET the subscription again and retry if still relevant. | | subscription_increase_too_large | 422 | לא | העלאת הסכום גדולה מהמותר לעדכון מהאתר | The new amount is more than 1.5 times the current one. extra.maximum_agorot is the most this call can set. | Raise it in steps of up to 50%, 30 days apart, or ask the business to change it in the app. | | subscription_increase_too_soon | 409 | לא | הסכום של המנוי הזה הועלה לאחרונה | A site raised this subscription's amount in the last 30 days. Lowering it is always allowed. | Try again after 30 days, or ask the business to change it in the app. | | subscription_amount_locked | 409 | לא | סכום המנוי הזה ננעל ביצירה | The business passes the processing fee to the customer on this subscription; its amount can be changed only in the Calio app. | Ask the business to change it in the app. | | test_mode_unsupported | 400 | לא | הפעולה הזו אינה זמינה במצב בדיקה | The operation needs a real card page (for example payment_method_update_link). | In test mode use the test helpers: POST /v1/subscriptions/{id}/test/activate and …/test/charge. | | shipping_fee_not_allowed | 403 | לא | העסק לא מאפשר לאתר לקבוע דמי משלוח | order.shipping_fee_agorot was sent, but the business did not allow the site to set a shipping fee. | Send the order without a shipping fee, or ask the business to allow it (Calio app → חיבור לאתר). | | discount_not_allowed | 403 | לא | העסק לא מאפשר לאתר לתת הנחה | order.discount was sent, but the business did not allow the site to give order discounts. | Send the order without a discount, or ask the business to allow it (Calio app → חיבור לאתר). | | unpaid_orders_not_allowed | 403 | לא | העסק לא מאפשר הזמנות בלי תשלום | POST /v1/orders was called, but the business did not allow orders without payment, or this key lacks orders:create_unpaid. | Take the payment with a checkout session, or ask the business to allow orders without payment and to create a key with that capability. | | order_invalid_state | 409 | לא | לא ניתן לשנות את ההזמנה במצב הנוכחי | For example marking a canceled order as shipped, or delivered → shipped. extra.status is the current status. | GET the order and act on its current status. A cancellation is done only by the business in the Calio app. | ## תקרות | מה | תקרה | |---|---| | קריאות נתונים — למפתח | 600 בדקה · 20000 בשעה | | כתיבות — למפתח | 120 בדקה · 5000 בשעה | | יצירת דפי תשלום — לעסק | 30 בדקה · 10000 ביום | | יצירת מנויים — לעסק | 30 בדקה · 2000 ביום | | רשומות לקוחות שנקראות — לעסק | 1000 בשעה; קריאת יותר ממחצית הלקוחות ביממה עוצרת את הרשימה עד אישור בעל העסק | | קריאות בחודש — לעסק | 100,000 (אפשר לבקש העלאה מהאפליקציה) | מעבר לתקרה ⇒ 429 עם Retry-After. בכל תשובה: X-RateLimit-Limit / X-RateLimit-Remaining. הצפה מכתובת אחת נעצרת עוד לפני ה-API: התשובה היא 429 בלי גוף JSON ובלי Retry-After. ממתינים דקה ומנסים שוב. כתובת שמעבר לכך חסומה ל-10 דקות. לקוח שהשרת שלו צריך יותר — פונה לקאליו. ## Webhooks — קאליו מודיעה לשרת של האתר - בעל העסק מגדיר את הכתובת באפליקציה (חיבור לאתר ← Webhooks) ומקבל סוד חתימה (whsec_…). כתובת לעולם לא משתנה דרך ה-API. - כל הודעה: POST JSON עם Calio-Event-Id, Calio-Api-Version ו-Calio-Signature: t=,v1=. - לענות 2xx מהר (עד 10 שניות). כשל ⇒ ניסיון חוזר אחרי 1 דק', 5 דק', 30 דק', 2 שע', 6 שע', 24 שע'. 3 ימים בלי הצלחה ⇒ הכתובת מושבתת ובעל העסק מקבל התראה. - 🔴 בכתובת של האתר החי — דחו כל אירוע עם livemode: false (ובכתובת הבדיקה — עם livemode: true). אירוע בדיקה אינו תשלום אמיתי. - אותו אירוע יכול להגיע יותר מפעם אחת — שמרו את id והתעלמו מכפילות. הסדר אינו מובטח, ו-data.object הוא המצב ברגע האירוע — לא בהכרח העדכני. לפני פעולה שתלויה במצב (למשל סימון מנוי כ"בפיגור" אחרי שכבר בוטל), קראו את האובייקט מה-API. - פספסתם? GET /v1/events מחזיר את כל האירועים של 30 הימים האחרונים. #### אימות חתימה HMAC-SHA256 על ".<הגוף הגולמי>" עם הסוד, ובדיקה ש-t בטווח של 5 דקות. בהחלפת סוד — 24 שעות שבהן ההודעה נושאת שתי חתימות v1. ```javascript // Node.js const crypto = require('crypto'); function verifyCalio(rawBody, header, secret) { const parts = Object.fromEntries(header.split(',').map((p) => p.split('='))); const t = Number(parts.t); if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false; const expected = crypto.createHmac('sha256', secret).update(t + '.' + rawBody, 'utf8').digest('hex'); const want = Buffer.from(expected, 'hex'); return header.split(',').filter((p) => /^v1=[0-9a-f]{64}$/.test(p)).some((p) => { const got = Buffer.from(p.slice(3), 'hex'); return got.length === want.length && crypto.timingSafeEqual(got, want); }); } ``` ```python # Python import hmac, hashlib, time def verify_calio(raw_body: bytes, header: str, secret: str) -> bool: parts = [p.split('=', 1) for p in header.split(',') if '=' in p] t = next((int(v) for k, v in parts if k == 't'), None) if not t or abs(time.time() - t) > 300: return False expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest() return any(hmac.compare_digest(expected, v) for k, v in parts if k == 'v1') ``` ```php 300) return false; $expected = hash_hmac('sha256', $t . '.' . $rawBody, $secret); foreach ($sigs as $s) if (hash_equals($expected, $s)) return true; return false; } ``` #### האירועים | type | אובייקט | מתי | מה לעשות | |---|---|---|---| | checkout.session.completed | CheckoutSession | הקונה שילם, והכסף אומת מול חברת הסליקה. | אפשר להציג 'ההזמנה התקבלה'. את השירות פותחים לפי payment.succeeded. | | checkout.session.expired | CheckoutSession | דף התשלום פג בלי תשלום. | לשחרר את העגלה / להציע ללקוח קישור חדש. | | checkout.session.canceled | CheckoutSession | הדף בוטל (ע"י האתר או העסק). | — | | payment.succeeded | Payment | הכסף התקבל. נשלח כשהעסקה נרשמה — או אם הרישום מתעכב, עם document_status: pending. | 🔴 לשלוח סחורה / לפתוח שירות — רק על האירוע הזה (ואחרי אימות חתימה). | | payment.requires_attention | Payment | נפתח issue שהעסק צריך לטפל בו באפליקציה (למשל המסמך לא הופק). | מידע בלבד — לא סיבה לעצור את הלקוח. | | payment.attention_resolved | Payment | כל ה-issues הפתוחים נסגרו. | — | | payment.refunded | Payment | התשלום זוכה במלואו (באפליקציה). | לבטל את ההזמנה / את השירות באתר. | | payment.partially_refunded | Payment | זיכוי חלקי (באפליקציה). refunded_amount_agorot מעודכן. | לעדכן את ההזמנה באתר. | | document.created | Payment | הופק מסמך חשבונאי על תשלום (גם מסמך שהופק מאוחר יותר באפליקציה). | — | | subscription.activated | Subscription | הלקוח הזין כרטיס בדף המנוי והמנוי פעיל. החיוב הראשון — היום (או ב-start_date). | לפתוח את השירות למנוי. | | subscription.payment_succeeded | Subscription | חיוב מחזור הצליח (נרשמה עסקה עם קבלה). charges_count עלה. | להאריך את השירות לתקופה הבאה. | | subscription.payment_failed | Subscription | חיוב מחזור נכשל. המנוע מנסה שוב כל יום (עד 5 ניסיונות) — אלא אם הכרטיס נדחה סופית. | להציע ללקוח לעדכן כרטיס (payment_method_update_link). | | subscription.past_due | Subscription | המנוי בפיגור: past_due_reason אומר למה (payment_failed / card_declined / payment_method_invalid). | לשלוח ללקוח קישור לעדכון כרטיס. לא לחסום מיד — בכשל רך המנוע עוד מנסה. | | subscription.recovered | Subscription | מנוי שהיה בפיגור חזר להיות פעיל (חיוב הצליח או הוחלף כרטיס). | להסיר הודעת פיגור באתר. | | subscription.paused | Subscription | המנוי הושהה (דרך ה-API או באפליקציה). אין חיובים עד חידוש. | להשהות את השירות. | | subscription.resumed | Subscription | המנוי חודש אחרי השהיה. החיוב הבא — בהרצה הקרובה (08:00). | לחדש את השירות. | | subscription.canceled | Subscription | המנוי בוטל — דרך ה-API, באפליקציה, או אחרי 5 כשלונות רצופים. | לסיים את השירות בסוף התקופה ששולמה. | | subscription.completed | Subscription | המנוי הגיע ל-max_charges והסתיים. | — | | subscription.updated | Subscription | סכום המנוי שונה, או שהלקוח החליף כרטיס. previous אומר מה השתנה. | — | | order.created | Order | הזמנה נוצרה: הזמנה ששולמה בדף התשלום (checkout עם order), או הזמנה בלי תשלום (POST /v1/orders). | לשמור את id ואת order_number. payment_status=paid ⇒ לספק; pending ⇒ לחכות ל-order.paid. | | order.status_changed | Order | סטטוס ההזמנה השתנה — ע"י בעל העסק באפליקציה (אושרה / נשלחה / נמסרה / בוטלה) או ע"י האתר (POST …/status). data.previous.status = הסטטוס הקודם. | לעדכן את מצב ההזמנה באתר. canceled אחרי תשלום ⇒ גם payment.refunded (הזיכוי נעשה באפליקציה). | | order.paid | Order | הזמנה בלי תשלום (מזומן לשליח / תשלום באיסוף / העברה) סומנה "שולמה" באפליקציה. | לסמן את ההזמנה כמשולמת באתר. | ## אובייקט התשלום — שלושה צירים נפרדים - status — הכסף: succeeded / partially_refunded / refunded. - document_status — המסמך: issued / pending / failed / not_required. - requires_attention + issues[] — מה בעל העסק צריך לטפל בו באפליקציה. אף פעם לא סיבה לעצור את הקונה: הכסף התקבל. לדוגמה: תשלום שהצליח אבל הקבלה לא הופקה ⇒ status: succeeded · document_status: failed · requires_attention: true · issues: [document_generation_failed]. שולחים את ההזמנה; בעל העסק מפיק את הקבלה מהאפליקציה, ואז מגיע document.created. | issue | חומרה | משמעות | |---|---|---| | document_generation_failed | action_required | התשלום התקבל אבל הקבלה לא הופקה. יש להפיק אותה מהאפליקציה. | | document_amount_mismatch | action_required | סכום המסמך אינו תואם לסכום ששולם. יש לבדוק באפליקציה. | | missing_tax_invoice | action_required | חסרה חשבונית מס לעסקה. | | missing_receipt | action_required | חסרה קבלה לעסקה. | | allocation_number_missing | warning | החשבונית הופקה בלי מספר הקצאה. | | refund_incomplete | action_required | זיכוי לא הושלם במלואו. יש לבדוק באפליקציה. | | stock_shortfall | warning | המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה). | | stock_reconcile_failed | warning | עדכון המלאי לא הושלם. יש לבדוק את המלאי באפליקציה. | | order_recording_delayed | warning | התשלום התקבל ורישום העסקה מתעכב. המערכת מנסה שוב. | | order_recording_failed | critical | התשלום התקבל אבל העסקה לא נרשמה. קאליו קיבלה התראה. | | paid_after_expiry | warning | התשלום התקבל אחרי שדף התשלום פג. | | duplicate_payment | action_required | הלקוח שילם פעמיים על אותו דף תשלום. יש לזכות את התשלום הכפול מהאפליקציה. | | amount_mismatch | critical | הסכום שהתקבל שונה מהסכום שנדרש. קאליו קיבלה התראה. | | business_cannot_issue_documents | action_required | התשלום התקבל אבל העסק אינו מחובר להפקת מסמכים. | ## הזמנות — כמו הזמנה מחנות קאליו חנות שמחוברת ל-API יכולה לשלוח יחד עם דף התשלום אובייקט order: שיטת משלוח, כתובת, דמי משלוח, תאריך וחלון שעות, הערה ושדות נוספים. אחרי התשלום נוצרת הזמנה במסך ההזמנות של בעל העסק — לצד הזמנות החנות שלו — והוא מטפל בה כרגיל: אושרה ← נשלחה ← נמסרה, או ביטול שמזכה את הלקוח. - בלי order — דף התשלום נרשם כעסקה בלבד, כמו תמיד. - fulfillment: shipping (חובה shipping_address) / pickup / none. - דמי משלוח והנחה (discount: amount_agorot + label) — רק אם בעל העסק אישר זאת לאתר במסך החיבור. בלי אישור ⇒ shipping_fee_not_allowed / discount_not_allowed. מחירי המוצרים — תמיד מהקטלוג. - requested_date — היום או מאוחר יותר (לפי שעון ישראל), עד שנה קדימה; time_slot רק יחד איתו. הכללים של האתר (אזורים, ימי משלוח) לא נבדקים מול קאליו — ההזמנה היא מה שהקונה בחר באתר. - אחרי התשלום: checkout_session.order_id ו-payment.order_id, האירוע order.created, ו-GET /v1/orders/{id}. - האתר יכול לסמן נשלחה / נמסרה (POST /v1/orders/{id}/status). ביטול — רק באפליקציה, כי הוא מזכה את הלקוח; מגיע לאתר כ-order.status_changed + payment.refunded. #### הזמנה בלי תשלום POST /v1/orders — מזומן לשליח / תשלום באיסוף / העברה. ההזמנה נכנסת כ-pending (ממתינה לתשלום), בלי עסקה ובלי קבלה. כשבעל העסק מסמן "שולם" באפליקציה נוצרות עסקה וקבלה, המלאי יורד, ומגיע order.paid. > ארבע הגנות, כי אין כאן תשלום שמסנן הזמנות מזויפות: בעל העסק מדליק את האפשרות במפורש · המפתח צריך את היכולת orders:create_unpaid (לא ניתנת כברירת מחדל) · עד 50 הזמנות כאלה ביום · המלאי לא נתפס עד "שולם". ## מה במכוון לא קיים ב-API - זיכויים — רק באפליקציה, ע"י אדם מזוהה. זיכוי שנעשה שם מגיע לאתר כ-payment.refunded. - חיוב כרטיס שמור — אין. מנויים מחויבים ע"י מנוע החיובים של קאליו בלבד, אחרי שהלקוח עצמו הזין כרטיס בדף של קאליו. - הפקת מסמך בלי תשלום — אין. מסמך נוצר רק מתשלום אמיתי שעבר דרכנו. - מחיקת לקוח — רק באפליקציה. - מחיר שהאתר קובע למוצר מהקטלוג — אין. המחיר הוא מחיר הקטלוג; שורה חופשית (למשל משלוח) — רק אם בעל העסק אישר. > כך, גם אם מפתח דלף: אי אפשר להחזיר כסף, לחייב כרטיס של לקוח, או להפיק חשבונית. ## מדריך נקודות הקצה ### חשבון #### GET /v1/account — פרטי החיבור — לאיזה עסק המפתח שייך ומה מותר לו הקריאה הראשונה בכל אינטגרציה: מאשרת שהמפתח עובד, במצב test או live, ומחזירה את ההרשאות שלו. readiness עונה האם דף תשלום live יתקבל עכשיו — גם במפתח test. יכולת: account:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/account \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "account", "livemode": true, "business": { "name": "סטודיו דנה" }, "api_key": { "id": "a4F2k9QwErTyUiOp1234", "display": "calio_sk_live_a4F2…••••3d91", "name": null, "capabilities": [ "account:read" ] }, "request_ip": "203.0.113.10", "readiness": { "can_accept_live_payments": true, "live_blocker": null, "max_installments": 12, "minimum_agorot": 100, "maximum_agorot": null, "custom_lines_enabled": true, "return_domains": [ "shop.co.il" ] } } ``` ### דפי תשלום #### POST /v1/checkout_sessions — יצירת דף תשלום מקבל מוצרים מהקטלוג (המחיר מהשרת) ושורות חופשיות, ומחזיר כתובת לדף התשלום של קאליו. את הקונה מפנים ל-url. אישור התשלום מגיע ב-webhook (payment.succeeded) — לא לפי החזרה לדפדפן. עם order — אחרי התשלום נוצרת הזמנה במסך ההזמנות של העסק (order_id). יכולת: checkout:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | order | object | | | | order.fulfillment | string | חובה | משלוח / איסוף עצמי / ללא (שירות, מוצר דיגיטלי) — אחד מ: shipping, pickup, none | | order.shipping_address | object | | חובה כש-fulfillment הוא shipping | | order.shipping_method_name | string | | השם שהקונה בחר באתר, למשל "שליח עד הבית" — עד 60 תווים | | order.shipping_fee_agorot | integer | | רק אם בעל העסק אישר לאתר לקבוע דמי משלוח — מינ' 0 · מקס' 10000000 | | order.discount | object | | הנחה על ההזמנה — רק אם בעל העסק אישר לאתר לתת הנחות | | order.requested_date | string | | YYYY-MM-DD — היום או מאוחר יותר, עד שנה קדימה | | order.time_slot | object | | HH:MM — רק יחד עם requested_date | | order.note | string | | הערת הקונה — עד 500 תווים | | order.extra_fields | array | | שדות נוספים מהאתר (הקדשה, מספר טלפון לשליח…) — מוצגים בהזמנה — עד 10 פריטים | | lines | array | חובה | עד 100 פריטים | | lines[].product_id | string | | מוצר או שירות מהקטלוג — המחיר נלקח מהקטלוג | | lines[].quantity | number | חובה | מינ' 0.001 · מקס' 100000 | | lines[].variant | object | | שם קבוצה → אפשרות (או מערך לקבוצה מרובת-בחירה) | | lines[].name | string | | שורה חופשית בלבד — עד 120 תווים | | lines[].unit_price_agorot | integer | | שורה חופשית בלבד — מינ' 1 · מקס' 100000000 | | expected_total_agorot | integer | | מינ' 1 | | customer | object | | | | customer.name | string | חובה | עד 120 תווים | | customer.phone | string | | תבנית ^\+?[0-9][0-9\- ]{7,18}$ | | customer.email | string | | עד 254 תווים · תבנית ^[^@\s]+@[^@\s]+\.[^@\s]+$ | | customer.tax_id | string | | תבנית ^[0-9]{5,9}$ | | customer.company_name | string | | עד 120 תווים | | customer_id | string | | תבנית ^cus_[A-Za-z0-9_-]{1,128}$ | | reference | string | | עד 64 תווים | | metadata | object | | | | success_url | string | | https בלבד, בדומיין שאושר באפליקציה | | cancel_url | string | | https בלבד, בדומיין שאושר באפליקציה | | max_installments | integer | | מינ' 1 · מקס' 12 | | expires_in_minutes | integer | | מינ' 10 · מקס' 120 | ```bash curl -X POST https://api.calio-app.com/v1/checkout_sessions \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "lines": [ { "product_id": "prd_shirt1", "quantity": 2, "variant": { "מידה": "M" } }, { "name": "דמי משלוח", "quantity": 1, "unit_price_agorot": 2500 } ], "customer": { "name": "דנה כהן", "phone": "0501234567", "email": "dana@example.co.il" }, "reference": "ORDER-1042", "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart" }' ``` תשובה 201: ```json { "object": "checkout_session", "id": "cs_ps_x", "livemode": true, "status": "open", "url": "https://calio-app.com/p/ps_x", "created": "2025-10-18T11:40:00.000Z", "expires_at": "2025-10-18T12:10:00.000Z", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "customer": { "id": null, "name": "דנה כהן", "phone": "0501234567", "email": "d@x.co.il" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900, "variant": { "משך": "60" } }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000, "variant": null } ], "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "currency": "ILS", "max_installments": 1, "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart", "payment_id": null, "order": null, "order_id": null } ``` Errors: product_not_found, product_unavailable, product_out_of_stock, invalid_variant, invalid_quantity, custom_lines_disabled, price_changed, amount_below_minimum, amount_above_business_limit, installments_not_allowed, url_domain_not_allowed, business_cannot_accept_payments, business_cannot_issue_documents, plan_quota_reached, provider_not_supported_yet, customer_not_found, shipping_fee_not_allowed, discount_not_allowed #### GET /v1/checkout_sessions — רשימת דפי תשלום החדשים קודם. עימוד בסמן: starting_after = ה-id האחרון שקיבלתם. יכולת: checkout:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | ```bash curl https://api.calio-app.com/v1/checkout_sessions \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "checkout_session", "id": "cs_ps_x", "livemode": true, "status": "open", "url": "https://calio-app.com/p/ps_x", "created": "2025-10-18T11:40:00.000Z", "expires_at": "2025-10-18T12:10:00.000Z", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "customer": { "id": null, "name": "דנה כהן", "phone": "0501234567", "email": "d@x.co.il" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900, "variant": { "משך": "60" } }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000, "variant": null } ], "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "currency": "ILS", "max_installments": 1, "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart", "payment_id": null, "order": null, "order_id": null }, { "object": "checkout_session", "id": "cs_ps_x", "livemode": true, "status": "complete", "url": null, "created": "2025-10-18T11:40:00.000Z", "expires_at": "2025-10-18T12:10:00.000Z", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "customer": { "id": null, "name": "דנה כהן", "phone": "0501234567", "email": "d@x.co.il" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900, "variant": { "משך": "60" } }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000, "variant": null } ], "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "currency": "ILS", "max_installments": 1, "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart", "payment_id": "pay_ps_x", "order": null, "order_id": null } ], "has_more": false, "next_cursor": "cs_ps_x" } ``` #### GET /v1/checkout_sessions/{id} — דף תשלום מצב עדכני של דף תשלום. 404 גם לדף של עסק אחר. יכולת: checkout:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/checkout_sessions/cs_ps_x \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "checkout_session", "id": "cs_ps_x", "livemode": true, "status": "complete", "url": null, "created": "2025-10-18T11:40:00.000Z", "expires_at": "2025-10-18T12:10:00.000Z", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "customer": { "id": null, "name": "דנה כהן", "phone": "0501234567", "email": "d@x.co.il" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900, "variant": { "משך": "60" } }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000, "variant": null } ], "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "currency": "ILS", "max_installments": 1, "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart", "payment_id": "pay_ps_x", "order": null, "order_id": null } ``` Errors: resource_not_found #### POST /v1/checkout_sessions/{id}/expire — ביטול דף תשלום פתוח דף שכבר שולם, פג או בוטל — 409. אם הקונה פתח את דף התשלום ב-3 הדקות האחרונות — 409 עם Retry-After. יכולת: checkout:write · סוג קצב: write ```bash curl -X POST https://api.calio-app.com/v1/checkout_sessions/cs_ps_x/expire \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200: ```json { "object": "checkout_session", "id": "cs_ps_x", "livemode": true, "status": "canceled", "url": null, "created": "2025-10-18T11:40:00.000Z", "expires_at": null, "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "customer": { "id": null, "name": "דנה כהן", "phone": "0501234567", "email": "d@x.co.il" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900, "variant": { "משך": "60" } }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000, "variant": null } ], "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "currency": "ILS", "max_installments": 1, "success_url": "https://shop.co.il/thanks", "cancel_url": "https://shop.co.il/cart", "payment_id": null, "order": null, "order_id": null } ``` Errors: resource_not_found, checkout_session_not_open, checkout_session_in_payment ### תשלומים #### GET /v1/payments — רשימת תשלומים תשלומים שהתקבלו דרך ה-API, החדשים קודם. יכולת: payments:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | ```bash curl https://api.calio-app.com/v1/payments \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "payment", "id": "pay_ps_x", "livemode": true, "status": "succeeded", "document_status": "failed", "requires_attention": true, "issues": [ { "code": "stock_shortfall", "severity": "warning", "message": "המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה).", "created": "2025-10-18T11:41:02.000Z", "resolved": null }, { "code": "document_generation_failed", "severity": "action_required", "message": "התשלום התקבל אבל הקבלה לא הופקה. יש להפיק אותה מהאפליקציה.", "created": null, "resolved": null } ], "checkout_session_id": "cs_ps_x", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "refunded_amount_agorot": 0, "currency": "ILS", "paid_at": "2025-10-18T11:41:01.000Z", "payment_method": { "type": "card", "brand": "visa", "last4": "4242", "installments": 1 }, "customer": { "id": "cus_c7" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900 }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000 } ], "documents": [], "order_id": null } ], "has_more": true, "next_cursor": "pay_ps_x" } ``` #### GET /v1/payments/{id} — תשלום שלושה צירים נפרדים: status (הכסף), document_status (המסמך), requires_attention + issues (מה העסק צריך לטפל). יכולת: payments:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/payments/pay_ps_x \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "payment", "id": "pay_ps_x", "livemode": true, "status": "succeeded", "document_status": "failed", "requires_attention": true, "issues": [ { "code": "stock_shortfall", "severity": "warning", "message": "המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה).", "created": "2025-10-18T11:41:02.000Z", "resolved": null }, { "code": "document_generation_failed", "severity": "action_required", "message": "התשלום התקבל אבל הקבלה לא הופקה. יש להפיק אותה מהאפליקציה.", "created": null, "resolved": null } ], "checkout_session_id": "cs_ps_x", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "refunded_amount_agorot": 0, "currency": "ILS", "paid_at": "2025-10-18T11:41:01.000Z", "payment_method": { "type": "card", "brand": "visa", "last4": "4242", "installments": 1 }, "customer": { "id": "cus_c7" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900 }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000 } ], "documents": [], "order_id": null } ``` Errors: resource_not_found #### POST /v1/payments/{id}/test/refund — בדיקה: זיכוי מדומה מצב בדיקה בלבד. זיכוי אמיתי נעשה רק באפליקציה של קאליו, על ידי אדם — ולתשלום בדיקה אין שם מכירה לזכות. הקריאה מגדילה את הסכום שזוכה בתשלום הבדיקה, ואחריה נשלח האירוע הרגיל: payment.partially_refunded או payment.refunded. לא זז כסף, לא נוצרת מכירה ולא מופק מסמך זיכוי. בלי amount_agorot — כל מה שעוד לא זוכה. יכולת: checkout:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | amount_agorot | integer | | מינ' 1 · מקס' 100000000 | ```bash curl -X POST https://api.calio-app.com/v1/payments/pay_ps_x/test/refund \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200: ```json { "object": "payment", "id": "pay_ps_x", "livemode": false, "status": "partially_refunded", "document_status": "issued", "requires_attention": true, "issues": [ { "code": "stock_shortfall", "severity": "warning", "message": "המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה).", "created": "2025-10-18T11:41:02.000Z", "resolved": null } ], "checkout_session_id": "cs_ps_x", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "refunded_amount_agorot": 1000, "currency": "ILS", "paid_at": "2025-10-18T11:41:01.000Z", "payment_method": { "type": "card", "brand": "visa", "last4": "4242", "installments": 1 }, "customer": { "id": "cus_c7" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900 }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000 } ], "documents": [ { "id": "doc_test_ps_x", "type": "test_receipt", "number": "TEST-123456", "status": "issued", "pdf_url": null, "allocation_number": null } ], "order_id": null } ``` Errors: resource_not_found, invalid_parameter ### קטלוג #### GET /v1/products — מוצרים ושירותים כל מה שהעסק לא הסתיר מה-API. מחירים באגורות — אותו מחיר שדף התשלום יגבה. סינון: type, category. עימוד בסמן. יכולת: catalog:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | | type | string | | אחד מ: product, service | | category | string | | עד 128 תווים | ```bash curl https://api.calio-app.com/v1/products \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "product", "id": "prd_shirt1", "type": "product", "name": "חולצה", "description": "כותנה", "price_agorot": 8000, "sale_price_agorot": 7200, "currency": "ILS", "duration_minutes": null, "images": [ "https://x/a.jpg" ], "categories": [ { "id": "c1", "name": "בגדים" } ], "variant_groups": [ { "name": "מידה", "selection": "single", "min_select": null, "max_select": null, "options": [ { "name": "M", "price_adjustment_agorot": 0, "sold_out": false }, { "name": "XL", "price_adjustment_agorot": 1000, "sold_out": true } ] } ], "quantity": { "unit": "quantity", "step": 1, "min": 1, "max": 999, "default": 1 }, "stock": { "tracked": true, "available": 9, "status": "in_stock", "by_variant": { "מידה=M": 1 } }, "purchasable": true }, { "object": "product", "id": "prd_svc1", "type": "service", "name": "שיעור", "description": null, "price_agorot": 25900, "sale_price_agorot": null, "currency": "ILS", "duration_minutes": 60, "images": [], "categories": [], "variant_groups": [], "quantity": { "unit": "quantity", "step": 1, "min": 1, "max": 999, "default": 1 }, "stock": { "tracked": false, "available": null, "status": null, "by_variant": null }, "purchasable": true } ], "has_more": false, "next_cursor": "prd_svc1" } ``` #### GET /v1/products/{id} — מוצר או שירות כולל וריאנטים, כללי כמות ומלאי זמין. יכולת: catalog:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/products/prd_shirt1 \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "product", "id": "prd_shirt1", "type": "product", "name": "חולצה", "description": "כותנה", "price_agorot": 8000, "sale_price_agorot": 7200, "currency": "ILS", "duration_minutes": null, "images": [ "https://x/a.jpg" ], "categories": [ { "id": "c1", "name": "בגדים" } ], "variant_groups": [ { "name": "מידה", "selection": "single", "min_select": null, "max_select": null, "options": [ { "name": "M", "price_adjustment_agorot": 0, "sold_out": false }, { "name": "XL", "price_adjustment_agorot": 1000, "sold_out": true } ] } ], "quantity": { "unit": "quantity", "step": 1, "min": 1, "max": 999, "default": 1 }, "stock": { "tracked": true, "available": 9, "status": "in_stock", "by_variant": { "מידה=M": 1 } }, "purchasable": true } ``` Errors: resource_not_found #### GET /v1/categories — קטגוריות הקטגוריות של קטלוג העסק. יכולת: catalog:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/categories \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "category", "id": "c1", "name": "בגדים" } ], "has_more": false, "next_cursor": null } ``` ### לקוחות #### POST /v1/customers — יצירת לקוח יוצר כרטיס לקוח של העסק. טלפון/מייל שכבר קיימים ⇒ 409 customer_exists עם מזהה הלקוח הקיים (אין כפילות שקטה ואין דריסה). במצב בדיקה — לקוח ארגז-חול שלא מופיע באפליקציה. יכולת: customers:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | name | string | חובה | עד 120 תווים | | phone | string | | נייד ישראלי — 05XXXXXXXX או +9725XXXXXXXX | | email | string | | עד 254 תווים · תבנית ^[^@\s]+@[^@\s]+\.[^@\s]+$ | | tax_id | string | | ח.פ. / ע.מ. — רק עם company_name | | company_name | string | | עד 120 תווים | | address | object (או null) | | | | marketing_consent | boolean | | true רק אם הלקוח אישר דיוור באתר | ```bash curl -X POST https://api.calio-app.com/v1/customers \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "name": "דנה כהן", "phone": "0501234567", "email": "dana@example.co.il", "marketing_consent": true }' ``` תשובה 201 — כרטיס לקוח של העסק — אותו כרטיס באפליקציה ובאתר. מוחזרים רק השדות המתועדים כאן.: ```json { "object": "customer", "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "d@x.co.il", "company_name": null, "tax_id": null, "address": { "street": "הרצל 1", "city": "תל אביב", "zip": null }, "marketing_consent": true, "created_at": "2025-10-18T11:40:00.000Z", "livemode": true } ``` Errors: customer_exists #### GET /v1/customers — חיפוש / רשימת לקוחות ?phone= או ?email= — התאמה מדויקת (customers:read). בלי פרמטר חיפוש — כל הרשימה בעימוד (דורש גם customers:list). כל רשומה שנקראת נספרת: עד 1,000 בשעה; קריאת יותר ממחצית הלקוחות ביממה עוצרת את הרשימה עד אישור בעל העסק. יכולת: customers:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | | phone | string | | עד 20 תווים | | email | string | | עד 254 תווים | ```bash curl https://api.calio-app.com/v1/customers \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "customer", "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "d@x.co.il", "company_name": null, "tax_id": null, "address": { "street": "הרצל 1", "city": "תל אביב", "zip": null }, "marketing_consent": true, "created_at": "2025-10-18T11:40:00.000Z", "livemode": true }, { "object": "customer", "id": "cus_c8", "name": "סטודיו", "phone": null, "email": null, "company_name": "סטודיו בע\"מ", "tax_id": "515555555", "address": null, "marketing_consent": false, "created_at": "1970-01-01T00:00:00.001Z", "livemode": true } ], "has_more": false, "next_cursor": "cus_c8" } ``` Errors: capability_denied, customers_list_disabled, customers_list_blocked #### GET /v1/customers/{id} — לקוח כרטיס הלקוח. יכולת: customers:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/customers/cus_c7 \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200 — כרטיס לקוח של העסק — אותו כרטיס באפליקציה ובאתר. מוחזרים רק השדות המתועדים כאן.: ```json { "object": "customer", "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "d@x.co.il", "company_name": null, "tax_id": null, "address": { "street": "הרצל 1", "city": "תל אביב", "zip": null }, "marketing_consent": true, "created_at": "2025-10-18T11:40:00.000Z", "livemode": true } ``` Errors: resource_not_found #### PATCH /v1/customers/{id} — עדכון לקוח שולחים רק את מה שמשתנה; null מוחק שדה. טלפון/מייל של לקוח אחר ⇒ 409 customer_exists. מחיקת לקוח — רק באפליקציה. יכולת: customers:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | name | string | | עד 120 תווים | | phone | string (או null) | | תבנית ^\+?[0-9][0-9\- ]{7,18}$ | | email | string (או null) | | עד 254 תווים · תבנית ^[^@\s]+@[^@\s]+\.[^@\s]+$ | | tax_id | string (או null) | | תבנית ^[0-9]{5,9}$ | | company_name | string (או null) | | עד 120 תווים | | address | object (או null) | | | | marketing_consent | boolean | | true רק אם הלקוח אישר דיוור באתר | ```bash curl -X PATCH https://api.calio-app.com/v1/customers/cus_c7 \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "email": "dana.c@example.co.il" }' ``` תשובה 200 — כרטיס לקוח של העסק — אותו כרטיס באפליקציה ובאתר. מוחזרים רק השדות המתועדים כאן.: ```json { "object": "customer", "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "d@x.co.il", "company_name": null, "tax_id": null, "address": { "street": "הרצל 1", "city": "תל אביב", "zip": null }, "marketing_consent": true, "created_at": "2025-10-18T11:40:00.000Z", "livemode": true } ``` Errors: resource_not_found, customer_exists #### GET /v1/customers/{id}/payments — תשלומי לקוח תשלומי ה-API של הלקוח, מהחדש לישן. יכולת: payments:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | ```bash curl https://api.calio-app.com/v1/customers/cus_c7/payments \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "payment", "id": "pay_ps_x", "livemode": true, "status": "succeeded", "document_status": "failed", "requires_attention": true, "issues": [ { "code": "stock_shortfall", "severity": "warning", "message": "המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה).", "created": "2025-10-18T11:41:02.000Z", "resolved": null }, { "code": "document_generation_failed", "severity": "action_required", "message": "התשלום התקבל אבל הקבלה לא הופקה. יש להפיק אותה מהאפליקציה.", "created": null, "resolved": null } ], "checkout_session_id": "cs_ps_x", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "refunded_amount_agorot": 0, "currency": "ILS", "paid_at": "2025-10-18T11:41:01.000Z", "payment_method": { "type": "card", "brand": "visa", "last4": "4242", "installments": 1 }, "customer": { "id": "cus_c7" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900 }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000 } ], "documents": [], "order_id": null } ], "has_more": false, "next_cursor": null } ``` Errors: resource_not_found ### הזמנות #### POST /v1/orders — הזמנה בלי תשלום מזומן לשליח / תשלום באיסוף / העברה. רק אם בעל העסק אישר, עם מפתח שיש לו orders:create_unpaid, ועד 50 ביום. ההזמנה נכנסת כ-pending (ממתינה לתשלום); המלאי והקבלה — כשבעל העסק מסמן שולם (order.paid). יכולת: orders:create_unpaid · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | lines | array | חובה | עד 100 פריטים | | lines[].product_id | string | | מוצר או שירות מהקטלוג — המחיר נלקח מהקטלוג | | lines[].quantity | number | חובה | מינ' 0.001 · מקס' 100000 | | lines[].variant | object | | שם קבוצה → אפשרות (או מערך לקבוצה מרובת-בחירה) | | lines[].name | string | | שורה חופשית בלבד — עד 120 תווים | | lines[].unit_price_agorot | integer | | שורה חופשית בלבד — מינ' 1 · מקס' 100000000 | | expected_total_agorot | integer | | מינ' 1 | | customer | object | | | | customer.name | string | חובה | עד 120 תווים | | customer.phone | string | | תבנית ^\+?[0-9][0-9\- ]{7,18}$ | | customer.email | string | | עד 254 תווים · תבנית ^[^@\s]+@[^@\s]+\.[^@\s]+$ | | customer.tax_id | string | | תבנית ^[0-9]{5,9}$ | | customer.company_name | string | | עד 120 תווים | | customer_id | string | | תבנית ^cus_[A-Za-z0-9_-]{1,128}$ | | order | object | חובה | | | order.fulfillment | string | חובה | משלוח / איסוף עצמי / ללא (שירות, מוצר דיגיטלי) — אחד מ: shipping, pickup, none | | order.shipping_address | object | | חובה כש-fulfillment הוא shipping | | order.shipping_method_name | string | | השם שהקונה בחר באתר, למשל "שליח עד הבית" — עד 60 תווים | | order.shipping_fee_agorot | integer | | רק אם בעל העסק אישר לאתר לקבוע דמי משלוח — מינ' 0 · מקס' 10000000 | | order.discount | object | | הנחה על ההזמנה — רק אם בעל העסק אישר לאתר לתת הנחות | | order.requested_date | string | | YYYY-MM-DD — היום או מאוחר יותר, עד שנה קדימה | | order.time_slot | object | | HH:MM — רק יחד עם requested_date | | order.note | string | | הערת הקונה — עד 500 תווים | | order.extra_fields | array | | שדות נוספים מהאתר (הקדשה, מספר טלפון לשליח…) — מוצגים בהזמנה — עד 10 פריטים | | payment | object | חובה | | | payment.method | string | חובה | אחד מ: cash_on_delivery, pay_at_pickup, bank_transfer, other | | payment.note | string | | עד 200 תווים | | reference | string | | עד 64 תווים | | metadata | object | | | ```bash curl -X POST https://api.calio-app.com/v1/orders \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 201 — הזמנה בערוץ האתר — מופיעה במסך ההזמנות של קאליו וזזה במחזור הטיפול הרגיל: ```json { "object": "order", "id": "ord_api_u1", "livemode": true, "order_number": "K7M2QX", "status": "pending", "payment_status": "pending", "payment_id": null, "payment_method": "cash_on_delivery", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "pending", "at": "2026-10-18T10:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" } ``` Errors: unpaid_orders_not_allowed, shipping_fee_not_allowed, discount_not_allowed, product_not_found, product_unavailable, product_out_of_stock, invalid_variant, invalid_quantity, custom_lines_disabled, price_changed, amount_below_minimum, customer_not_found #### GET /v1/orders — רשימת הזמנות הזמנות ערוץ האתר בלבד. ?status= ו-?payment_status= לסינון. יכולת: orders:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | | status | string | | אחד מ: pending, approved, shipped, delivered, canceled | | payment_status | string | | אחד מ: paid, pending, refunded | ```bash curl https://api.calio-app.com/v1/orders \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "order", "id": "ord_api_ps_x", "livemode": true, "order_number": "K7M2QX", "status": "approved", "payment_status": "paid", "payment_id": "pay_ps_x", "payment_method": "online_checkout", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "approved", "at": "2026-10-18T10:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" }, { "object": "order", "id": "ord_api_u1", "livemode": true, "order_number": "K7M2QX", "status": "pending", "payment_status": "pending", "payment_id": null, "payment_method": "cash_on_delivery", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "pending", "at": "2026-10-18T10:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" } ], "has_more": false, "next_cursor": "ord_api_u1" } ``` #### GET /v1/orders/{id} — הזמנה הזמנה של ערוץ האתר. יכולת: orders:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/orders/x \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200 — הזמנה בערוץ האתר — מופיעה במסך ההזמנות של קאליו וזזה במחזור הטיפול הרגיל: ```json { "object": "order", "id": "ord_api_ps_x", "livemode": true, "order_number": "K7M2QX", "status": "approved", "payment_status": "paid", "payment_id": "pay_ps_x", "payment_method": "online_checkout", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "approved", "at": "2026-10-18T10:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" } ``` Errors: resource_not_found #### POST /v1/orders/{id}/status — עדכון: נשלחה / נמסרה האתר מסמן shipped או delivered (למשל מחברת השליחויות). ביטול — רק באפליקציה (הוא מזכה את הלקוח). יכולת: orders:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | status | string | חובה | אחד מ: shipped, delivered | ```bash curl -X POST https://api.calio-app.com/v1/orders/x/status \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200 — הזמנה בערוץ האתר — מופיעה במסך ההזמנות של קאליו וזזה במחזור הטיפול הרגיל: ```json { "object": "order", "id": "ord_api_ps_x", "livemode": true, "order_number": "K7M2QX", "status": "shipped", "payment_status": "paid", "payment_id": "pay_ps_x", "payment_method": "online_checkout", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "approved", "at": "2026-10-18T10:00:00.000Z" }, { "status": "shipped", "at": "2026-10-18T11:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" } ``` Errors: order_invalid_state, resource_not_found #### POST /v1/orders/{id}/test/advance — בדיקה: שינוי סטטוס מצב בדיקה בלבד — מדמה את בעל העסק: shipped / delivered / canceled (הזמנה ממתינה מאושרת קודם). יכולת: orders:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | status | string | חובה | אחד מ: shipped, delivered, canceled | ```bash curl -X POST https://api.calio-app.com/v1/orders/x/test/advance \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200 — הזמנה בערוץ האתר — מופיעה במסך ההזמנות של קאליו וזזה במחזור הטיפול הרגיל: ```json { "object": "order", "id": "ord_api_ps_x", "livemode": true, "order_number": "K7M2QX", "status": "shipped", "payment_status": "paid", "payment_id": "pay_ps_x", "payment_method": "online_checkout", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "approved", "at": "2026-10-18T10:00:00.000Z" }, { "status": "shipped", "at": "2026-10-18T11:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" } ``` Errors: order_invalid_state, resource_not_found #### POST /v1/orders/{id}/test/mark_paid — בדיקה: סומנה כשולמה מצב בדיקה בלבד — הזמנה בלי תשלום מסומנת שולמה (order.paid). יכולת: orders:write · סוג קצב: write ```bash curl -X POST https://api.calio-app.com/v1/orders/x/test/mark_paid \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200 — הזמנה בערוץ האתר — מופיעה במסך ההזמנות של קאליו וזזה במחזור הטיפול הרגיל: ```json { "object": "order", "id": "ord_api_u1", "livemode": true, "order_number": "K7M2QX", "status": "pending", "payment_status": "paid", "payment_id": null, "payment_method": "cash_on_delivery", "payment_note": null, "reference": "WC-10293", "customer": { "id": "cus_c7", "name": "דנה כהן", "phone": "+972501234567", "email": "dana@example.com" }, "lines": [ { "type": "product", "product_id": "prd_shirt1", "name": "שמלה", "quantity": 1, "unit_price_agorot": 25000, "total_agorot": 25000, "variant": { "מידה": "M" } } ], "fulfillment": "shipping", "shipping_address": { "city": "תל אביב", "street": "דיזנגוף", "house_number": "100", "apartment": "4", "floor": null, "zip": "6433222" }, "shipping_method_name": "שליח עד הבית", "amounts": { "subtotal_agorot": 25000, "shipping_fee_agorot": 3000, "discount_agorot": 1000, "total_agorot": 27000 }, "discount_label": "WELCOME10", "requested_date": "2026-10-22", "time_slot": { "start": "16:00", "end": "20:00" }, "note": "להשאיר אצל השכן", "extra_fields": [ { "label": "הקדשה", "value": "מזל טוב" } ], "status_history": [ { "status": "pending", "at": "2026-10-18T10:00:00.000Z" } ], "documents": [], "created": "2026-10-18T10:00:00.000Z" } ``` Errors: order_invalid_state, resource_not_found ### מנויים #### POST /v1/subscriptions — יצירת מנוי יוצר מנוי ומחזיר setup_url — דף קאליו שבו הלקוח מזין כרטיס (לא נגבה כסף בדף). החיוב הראשון ביום ההזנה (או ב-start_date), ואז כל interval; כל חיוב = עסקה עם קבלה. האתר לעולם לא מחייב כרטיס בעצמו. עסק שהסליקה שלו עדיין לא תומכת במנויים מהאתר מקבל provider_not_supported_yet. יכולת: subscriptions:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | customer_id | string | | תבנית ^cus_[A-Za-z0-9_-]{1,128}$ | | customer | object | | | | customer.name | string | חובה | עד 120 תווים | | customer.phone | string | | נייד ישראלי — 05XXXXXXXX או +9725XXXXXXXX | | customer.email | string | | עד 254 תווים · תבנית ^[^@\s]+@[^@\s]+\.[^@\s]+$ | | customer.tax_id | string | | ח.פ. / ע.מ. — רק עם company_name | | customer.company_name | string | | עד 120 תווים | | customer.address | object (או null) | | | | customer.marketing_consent | boolean | | true רק אם הלקוח אישר דיוור באתר | | name | string | חובה | מה הלקוח רואה בדף ובקבלה — עד 120 תווים | | amount_agorot | integer | חובה | מינ' 1 · מקס' 100000000 | | interval | string | חובה | אין מנוי יומי ב-API — אחד מ: week, month, year | | start_date | string | | YYYY-MM-DD, עד שנה קדימה; חודשי/שנתי — יום 1–28. בלי ⇒ ביום שבו הלקוח מזין כרטיס | | max_charges | integer | | מינ' 1 · מקס' 1000 | | reference | string | | עד 64 תווים | | metadata | object | | | | success_url | string | | https בלבד, בדומיין שאושר באפליקציה | | cancel_url | string | | https בלבד, בדומיין שאושר באפליקציה | ```bash curl -X POST https://api.calio-app.com/v1/subscriptions \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "customer_id": "cus_c7", "name": "מנוי חודשי", "amount_agorot": 9900, "interval": "month", "reference": "MEMBER-7", "success_url": "https://shop.co.il/welcome" }' ``` תשובה 201 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "pending_payment_method", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": "https://calio-app.com/s/sps_x", "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": null, "max_charges": 12, "charges_count": 0, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: customer_not_found, customer_exists, amount_below_minimum, amount_above_business_limit, url_domain_not_allowed, business_cannot_accept_payments, business_cannot_issue_documents, plan_quota_reached, provider_not_supported_yet #### GET /v1/subscriptions — רשימת מנויים מנויים שנוצרו דרך ה-API. ?status= ו-?customer_id= לסינון. יכולת: subscriptions:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 140 תווים | | status | string | | אחד מ: pending_payment_method, active, past_due, paused, completed, canceled | | customer_id | string | | עד 140 תווים | ```bash curl https://api.calio-app.com/v1/subscriptions \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ], "has_more": false, "next_cursor": null } ``` #### GET /v1/subscriptions/{id} — מנוי כולל next_charge_date, charges_count, past_due_reason. יכולת: subscriptions:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/subscriptions/sub_x \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: resource_not_found #### PATCH /v1/subscriptions/{id} — שינוי סכום מנוי 🔴 דורש subscriptions:amount. יכולת: subscriptions:amount · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | amount_agorot | integer | חובה | מינ' 1 · מקס' 100000000 | ```bash curl -X PATCH https://api.calio-app.com/v1/subscriptions/sub_x \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "amount_agorot": 12900 }' ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found, amount_below_minimum, amount_above_business_limit, subscription_amount_locked, subscription_increase_too_large, subscription_increase_too_soon #### GET /v1/subscriptions/{id}/charges — חיובי מנוי כל ניסיון חיוב של המנוי, מהחדש לישן. יכולת: subscriptions:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/subscriptions/sub_x/charges \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "object": "subscription_charge", "id": "subch_sub_x_2", "status": "failed", "amount_agorot": 9900, "charge_number": 2, "failure_reason": "payment_failed", "payment_id": null, "created_at": "2025-10-18T11:41:02.000Z" }, { "object": "subscription_charge", "id": "subch_sub_x_1", "status": "succeeded", "amount_agorot": 9900, "charge_number": 1, "failure_reason": null, "payment_id": null, "created_at": "2025-10-18T11:40:00.000Z" } ], "has_more": false, "next_cursor": null } ``` Errors: resource_not_found #### POST /v1/subscriptions/{id}/pause — השהיית מנוי רק ממנוי active. אין חיובים עד חידוש. יכולת: subscriptions:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | reason | string | | עד 300 תווים | ```bash curl -X POST https://api.calio-app.com/v1/subscriptions/sub_x/pause \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "reason": "חופשה" }' ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found #### POST /v1/subscriptions/{id}/resume — חידוש מנוי רק ממנוי paused. החיוב הבא בהרצה הקרובה (08:00). מנוי בפיגור צריך כרטיס חדש — payment_method_update_link. יכולת: subscriptions:write · סוג קצב: write ```bash curl -X POST https://api.calio-app.com/v1/subscriptions/sub_x/resume \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found #### POST /v1/subscriptions/{id}/cancel — ביטול מנוי מכל מצב שאינו canceled/completed. אין חיובים נוספים. יכולת: subscriptions:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | reason | string | | עד 300 תווים | ```bash curl -X POST https://api.calio-app.com/v1/subscriptions/sub_x/cancel \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "reason": "הלקוח ביקש" }' ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found #### POST /v1/subscriptions/{id}/payment_method_update_link — קישור לעדכון כרטיס קישור (72 שעות) לדף שבו הלקוח מחליף כרטיס. אחרי החלפה ממצב פיגור — חיוב מיידי. יכולת: subscriptions:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | success_url | string | | https בלבד, בדומיין שאושר באפליקציה | | cancel_url | string | | https בלבד, בדומיין שאושר באפליקציה | ```bash curl -X POST https://api.calio-app.com/v1/subscriptions/sub_x/payment_method_update_link \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "success_url": "https://shop.co.il/account" }' ``` תשובה 201: ```json { "object": "payment_method_update_link", "subscription_id": "sub_x", "url": "https://calio-app.com/s/sps_x", "expires_at": "2026-10-21T10:00:00.000Z" } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found, url_domain_not_allowed, test_mode_unsupported #### POST /v1/subscriptions/{id}/test/activate — בדיקה: הלקוח הזין כרטיס מצב בדיקה בלבד — מדמה הזנת כרטיס בדף המנוי (גם החלפת כרטיס ממצב פיגור). שולח את אותם אירועים. יכולת: subscriptions:write · סוג קצב: write ```bash curl -X POST https://api.calio-app.com/v1/subscriptions/sub_x/test/activate \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{}' ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found #### POST /v1/subscriptions/{id}/test/charge — בדיקה: חיוב מחזור מצב בדיקה בלבד — מריץ את אותו כלל מצבים של מנוע החיובים: succeeded / declined (ניסיון חוזר) / card_declined (פיגור). יכולת: subscriptions:write · סוג קצב: write | שדה בגוף | סוג | חובה | הסבר | |---|---|---|---| | outcome | string | חובה | אחד מ: succeeded, declined, card_declined | ```bash curl -X POST https://api.calio-app.com/v1/subscriptions/sub_x/test/charge \ -H "Authorization: Bearer $CALIO_SECRET_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "outcome": "declined" }' ``` תשובה 200 — מנוי שנוצר דרך ה-API. פרטי הכרטיס לא נחשפים — רק has_payment_method.: ```json { "object": "subscription", "id": "sub_x", "status": "active", "past_due_reason": null, "name": "מנוי חודשי", "amount_agorot": 9900, "currency": "ILS", "interval": "month", "customer": { "id": "cus_c7" }, "setup_url": null, "has_payment_method": false, "start_date": "2025-10-18T11:40:00.000Z", "next_charge_date": "2025-11-18T11:40:00.000Z", "max_charges": 12, "charges_count": 1, "failed_attempts": 0, "total_charged_agorot": 9900, "last_charge_at": "2025-10-18T11:41:01.000Z", "latest_document": null, "paused_at": null, "canceled_at": null, "reference": "MEMBER-7", "metadata": { "plan": "gold" }, "created_at": "2025-10-18T11:30:00.000Z", "livemode": true } ``` Errors: subscription_invalid_state, subscription_changed, resource_not_found ### מסמכים #### GET /v1/documents/{id} — מסמך מסמך של תשלום API: סוג, מספר, סכום, מע"מ, מספר הקצאה והתשלום המקושר. מסמך שאינו של תשלום API נראה כמו מזהה שלא קיים. יכולת: documents:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/documents/doc_4417 \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200 — מסמך חשבונאי של תשלום שעבר דרך ה-API. קריאה בלבד — אין יצירת מסמך בלי תשלום.: ```json { "object": "document", "id": "doc_4417", "type": "taxInvoiceReceipt", "number": "10233", "status": "issued", "pdf_url": null, "amount_agorot": 28900, "vat_rate": 18, "vat_agorot": 4408, "pre_vat_agorot": 24492, "allocation_number": null, "is_credit": false, "payment_id": "pay_ps_x", "created_at": "2025-10-18T11:41:02.000Z", "livemode": true } ``` Errors: resource_not_found #### GET /v1/documents/{id}/pdf — PDF של מסמך קישור חתום ל-15 דקות, להורדה של הקובץ. הקישור הקבוע נמצא ב-pdf_url של המסמך. מסמך בדיקה — אין PDF. יכולת: documents:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/documents/doc_4417/pdf \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "document_pdf", "document_id": "doc_4417", "url": "https://storage.googleapis.com/signed?x=1", "expires_at": "2025-10-18T11:56:40.000Z" } ``` Errors: resource_not_found, document_pdf_unavailable ### אירועים #### GET /v1/events — אירועים 30 הימים האחרונים, החדשים קודם. לשחזור webhooks שלא הגיעו — סנכרון לילי. סינון לפי type. יכולת: events:read · סוג קצב: read | פרמטר | סוג | חובה | הסבר | |---|---|---|---| | limit | string | | 1–100, ברירת מחדל 20 | | starting_after | string | | עד 420 תווים | | type | string | | עד 64 תווים | ```bash curl https://api.calio-app.com/v1/events \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "object": "list", "data": [ { "id": "evt_payment.succeeded_pay_ps_x_1", "type": "payment.succeeded", "created": "2025-10-18T11:41:02.000Z", "livemode": true, "api_version": "2026-10-18", "data": { "object": { "object": "payment", "id": "pay_ps_x", "livemode": true, "status": "succeeded", "document_status": "failed", "requires_attention": true, "issues": [ { "code": "stock_shortfall", "severity": "warning", "message": "המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה).", "created": "2025-10-18T11:41:02.000Z", "resolved": null }, { "code": "document_generation_failed", "severity": "action_required", "message": "התשלום התקבל אבל הקבלה לא הופקה. יש להפיק אותה מהאפליקציה.", "created": null, "resolved": null } ], "checkout_session_id": "cs_ps_x", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "refunded_amount_agorot": 0, "currency": "ILS", "paid_at": "2025-10-18T11:41:01.000Z", "payment_method": { "type": "card", "brand": "visa", "last4": "4242", "installments": 1 }, "customer": { "id": "cus_c7" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900 }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000 } ], "documents": [], "order_id": null } } } ], "has_more": false, "next_cursor": "evt_payment.succeeded_pay_ps_x_1" } ``` #### GET /v1/events/{id} — אירוע אותו גוף בדיוק שנשלח ב-webhook. יכולת: events:read · סוג קצב: read ```bash curl https://api.calio-app.com/v1/events/evt_payment.succeeded_pay_ps_x_1 \ -H "Authorization: Bearer $CALIO_SECRET_KEY" ``` תשובה 200: ```json { "id": "evt_payment.succeeded_pay_ps_x_1", "type": "payment.succeeded", "created": "2025-10-18T11:41:02.000Z", "livemode": true, "api_version": "2026-10-18", "data": { "object": { "object": "payment", "id": "pay_ps_x", "livemode": true, "status": "succeeded", "document_status": "failed", "requires_attention": true, "issues": [ { "code": "stock_shortfall", "severity": "warning", "message": "המלאי ירד מתחת לאפס אחרי התשלום (שני קונים על אותה יחידה).", "created": "2025-10-18T11:41:02.000Z", "resolved": null }, { "code": "document_generation_failed", "severity": "action_required", "message": "התשלום התקבל אבל הקבלה לא הופקה. יש להפיק אותה מהאפליקציה.", "created": null, "resolved": null } ], "checkout_session_id": "cs_ps_x", "reference": "ORDER-1042", "metadata": { "cart_id": "c_88" }, "amount_total_agorot": 28900, "charged_amount_agorot": 28900, "refunded_amount_agorot": 0, "currency": "ILS", "paid_at": "2025-10-18T11:41:01.000Z", "payment_method": { "type": "card", "brand": "visa", "last4": "4242", "installments": 1 }, "customer": { "id": "cus_c7" }, "lines": [ { "type": "service", "product_id": "prd_svc1", "name": "שיעור פרטי", "quantity": 1, "unit_price_agorot": 25900, "total_agorot": 25900 }, { "type": "custom", "product_id": null, "name": "דמי רישום", "quantity": 1, "unit_price_agorot": 3000, "total_agorot": 3000 } ], "documents": [], "order_id": null } } } ``` Errors: resource_not_found