כל הזמנה ששולמה בחנות BigCommerce הופכת אוטומטית לחשבונית מס קבלה (או למסמך אחר לבחירתכם).
התקנה (5 דקות)#
ב-BigCommerce פתחו Settings → API → Store-level API accounts → Create API account. תנו הרשאת Orders במצב Read-only. שמרו את ה-Access token.
במערכת: חשבוניות → חיבורים → BigCommerce. הדביקו את ה-Access token ואת ה-Store hash (החלק שבכתובת ה-API:
api.bigcommerce.com/stores/<store_hash>/).הגדירו אסימון אימות: מחרוזת אקראית ארוכה (לפחות 32 תווים) והדביקו אותה בשדה הסוד.
צרו Webhook ב-API של BigCommerce. כתובת ה-
destinationמוצגת במסך החיבור, וה-headersמכילים את האסימון:curl -X POST "https://api.bigcommerce.com/stores/<store_hash>/v3/hooks" \ -H "X-Auth-Token: <ACCESS_TOKEN>" -H "Content-Type: application/json" \ -d '{ "scope": "store/order/statusUpdated", "destination": "https://invoice.slk.co.il/api/billing/ecommerce/bigcommerce/<hookId>", "is_active": true, "headers": { "x-slk-token": "<האסימון שהגדרתם>" } }'בחרו סוג מסמך ולחצו על שליחת הזמנת בדיקה. מסמך יופק להזמנות במצב Awaiting Fulfillment, Shipped או Completed שהתשלום בהן נקלט.
Developer reference#
Mode: hook, pull. Category: store. Refunds: not supported (see below).
Event. store/order/statusUpdated (and optionally store/order/created). BigCommerce sends only ids:
{ "store_id": "1025646", "producer": "stores/abc123xyz", "scope": "store/order/statusUpdated",
"data": { "type": "order", "id": 173331 }, "hash": "3f9ea4..." }Auth. BigCommerce does not sign webhook bodies. It does send custom headers supplied at webhook creation, so the receiver uses { kind: "token", header: "x-slk-token" }: the header value must equal the secret stored in SLK (constant-time compare). No secret configured means 401. Treat the token like a password; rotate it by re-creating the webhook.
Pull. After auth and classification the receiver calls, with X-Auth-Token: <access_token>:
GET https://api.bigcommerce.com/stores/{store_hash}/v2/orders/{id}GET .../v2/orders/{id}/products?limit=250GET .../v2/orders/{id}/shipping_addresses
A 404 answers 200 skipped. A network failure, 5xx or 401/403 answers 502 so BigCommerce retries. Missing credentials answer 502 with חסרים פרטי חיבור.
Which orders issue. status_id in {2 Shipped, 3 Partially Shipped, 8 Awaiting Pickup, 9 Awaiting Shipment, 10 Completed, 11 Awaiting Fulfillment} and payment_status in {paid, captured}. Anything else (Incomplete, Awaiting Payment, pending, empty) is acknowledged with 200 and no row; a later statusUpdated delivery re-evaluates it. Issuing is idempotent by (bigcommerce, order id).
Mapping.
| BigCommerce field | Document field |
|---|---|
order.id | externalId; apiIdentifier = bigcommerce-<id> |
products[].name | line name |
products[].quantity | line quantityMilli (x1000) |
products[].price_inc_tax | line unitPriceAgorot (gross, taxIncluded: true) |
order.total_tax over (total_inc_tax - total_tax) | vatBp (snapped to 1800 within 80bp) |
shipping_cost_inc_tax + handling_cost_inc_tax + wrapping_cost_inc_tax | line "משלוח" |
discount_amount + coupon_discount | document discountValue (fixed) |
billing_address.first_name/last_name (or company) | customerName |
billing_address.email | customerEmail |
billing_address.street_1/street_2/city/zip/country_iso2 | customerAddress |
currency_code | currency |
date_created (RFC 2822) | issueDate |
payment_method | payment type (cash / transfer / PayPal / check / store credit, else card) |
| sum of lines minus discount | the single payment row (amountAgorot) |
The payment row is computed from the document lines so the engine's "payments equal total" rule always holds; it can differ from BigCommerce's total_inc_tax by an agora of rounding.
Refunds. BigCommerce documents no refund webhook scope (only order scopes), so refunds are ignored. Issue a credit note manually in SLK.
Limits. Destination must be HTTPS on port 443 with a valid certificate and answer 200. Body cap 512 KB; rate limits per IP and per hook.
Test with curl (against your own hookId; the token configured as the secret):
curl -i -X POST "https://invoice.slk.co.il/api/billing/ecommerce/bigcommerce/<hookId>" \
-H "content-type: application/json" -H "x-slk-token: <TOKEN>" \
-d '{"store_id":"1025646","producer":"stores/abc123xyz","scope":"store/order/statusUpdated","data":{"type":"order","id":999000001},"hash":"x"}'Order id 999000001 is the built-in sample: it is answered from a fixture with no API call, so it works before credentials are set. Expected: {"ok":true,"status":"issued","documentId":"..."}.
Sources: webhooks, orders, order products, statuses.
Troubleshooting#
- 401 — הכותרת
x-slk-tokenחסרה או שונה מהסוד ששמרתם כאן. צרו את ה-Webhook מחדש עם הערך הנכון. - 404 — ה-hookId בכתובת שגוי. העתיקו שוב את הכתובת ממסך החיבור.
- 502 "חסרים פרטי חיבור" — מלאו Store hash ו-Access token במסך החיבור. BigCommerce ינסה שוב לבד.
- 502 "פרטי החיבור נדחו" — ל-API account אין הרשאת Orders, או שהאסימון הוחלף.
- ההזמנה לא הפיקה מסמך — בדקו שהיא במצב Awaiting Fulfillment, Shipped או Completed ושהתשלום נקלט (
payment_statusהוא paid או captured). הזמנה במצב Awaiting Payment מקבלת מסמך רק כשהסטטוס משתנה. - "blocked" — חבילת המנוי או מכסת המסמכים החודשית. "dormant" — מודול החיוב כבוי; הפעילו אותו ולחצו "הפק מסמך ידנית" ביומן ההזמנות.