חשבוניות SLK

Lemon Squeezy

הזמנות Lemon Squeezy מופקות כמסמך, והחזר הופך לחשבונית זיכוי

סליקה ותשלומיםWebhookהחזר ← זיכוי

מה צריך

אימות
חתימת HMAC-SHA256 (hex)x-signature
מה מדביקים
Signing secret של ה-Webhook ב-Lemon Squeezy
אירועים
order_createdorder_refunded
החזרים
החזר מפיק חשבונית זיכוי אוטומטית
הזמנת בדיקה
כפתור אחד במסך החיבור שולח הזמנה חתומה לדוגמה
בעמוד הזה

הזמנה ששולמה ב-Lemon Squeezy הופכת למסמך, והחזר הופך לחשבונית זיכוי.

חשוב לפני שמתחילים: Lemon Squeezy היא merchant of record. היא המוכרת ללקוח הקצה וגובה את המס בשמה. התייעצו עם רואה החשבון אם וכיצד להפיק מסמך על כל הזמנה לפני שמפעילים את החיבור.

התקנה (5 דקות)#

  1. ב-Lemon Squeezy: Settings → Webhooks → הוספת Webhook (+).
  2. ב-Callback URL הדביקו את כתובת ה-Webhook שמוצגת אצלכם במסך החיבור.
  3. בחרו Signing secret (מחרוזת אקראית משלכם, 6 עד 40 תווים) והדביקו אותה גם בשדה הסוד בחיבור.
  4. סמנו את האירועים order_created ו-order_refunded ושמרו.
  5. בחרו סוג מסמך ולחצו על "שליחת הזמנת בדיקה".

הערה: האירוע כולל רק את הפריט הראשון של ההזמנה (first_order_item). בהזמנה עם כמה פריטים המסמך יציג את הראשון, והסכום הכולל תמיד שווה לסכום ששולם.

Developer reference#

Endpoint: POST /api/billing/ecommerce/lemonsqueezy/<hookId>

Auth: X-Signature = HMAC-SHA256 of the raw body with the signing secret, hex ({ kind: "hmac", header: "x-signature", encoding: "hex" }). Docs: https://docs.lemonsqueezy.com/help/webhooks/signing-requests. Event name from meta.event_name (also the X-Event-Name header): https://docs.lemonsqueezy.com/help/webhooks/webhook-requests. Order attributes: https://docs.lemonsqueezy.com/api/orders/the-order-object

EventResult
order_created with attributes.status = "paid"document
order_refundedcredit note
anything else (subscriptions, licenses…)200 {skipped}
Lemon Squeezy fieldDocument
data.idexternalId, apiIdentifier = lemonsqueezy-<id>
user_name, user_emailcustomer (fallback לקוח/ה)
first_order_item.product_name (+ variant_name unless "Default"), quantitythe line
total (cents = agorot, no scaling)payment row and the line gross
subtotal, discount_totalshown as a document discount only when prices are tax-inclusive (or tax is 0) and subtotal − discount = total; otherwise the line carries the gross total
taxdocument VAT rate (nearest 18% / 17%, else statutory)
currencyuppercased; non-ILS needs an exchange rate (recorded as error)
test_modemarked "(test mode)" in the document comment

Refunds: the event has no refund id, so the id is <order id>:<refunded_amount> (stable on redelivery). status = refunded credits the whole document; partial_refund credits the cumulative refunded_amount, so a second partial refund on the same order needs a manual credit note.

Test with curl:

bash
HOOK="https://<your-host>/api/billing/ecommerce/lemonsqueezy/<hookId>"
SECRET="your-signing-secret"
BODY='{"meta":{"event_name":"order_created"},"data":{"type":"orders","id":"9001","attributes":{"order_number":1,"user_name":"אורי לוי","user_email":"[email protected]","currency":"ILS","subtotal":20000,"discount_total":0,"tax":3600,"total":23600,"tax_inclusive":false,"status":"paid","created_at":"2026-09-20T10:15:30.000000Z","first_order_item":{"product_name":"מדריך PDF","variant_name":"Default","price":20000,"quantity":1}}}}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -hex | sed 's/^.* //')
curl -i -X POST "$HOOK" -H "Content-Type: application/json" -H "X-Event-Name: order_created" -H "X-Signature: $SIG" -d "$BODY"

Troubleshooting#

  • 401 invalid signature: ה-Signing secret בחיבור שונה מזה שהגדרתם ב-Webhook (הם צריכים להיות זהים אות באות).
  • 401 secret is not configured: עדיין לא הדבקתם Signing secret.
  • 404 unknown hook: כתובת ה-Webhook לא הועתקה במלואה.
  • הזמנה לא הופקה (skipped): הסטטוס אינו paid, או שהאירוע אינו order_created / order_refunded.
  • הזמנה בסטטוס blocked או dormant: מגבלת החבילה או מודול החיוב כבוי. אפשר להפיק ידנית מיומן ההזמנות.
  • זיכוי בסטטוס error: ההזמנה המקורית לא הופקה אצלנו, ולכן אין מסמך לזכות.

פותחים חשבון בדקה, ואז מדביקים את הכתובת.

חברו את Lemon Squeezy
חיבור Lemon Squeezy לחשבוניות SLK — הוראות התקנה | פורטל המפתחים