Search by

billstack / oxid-module

raquikin

Billstack connector for OXID eShop 6.1 to 6.5: a key-protected JSON endpoint for orders, shipping confirmations, stock and articles.

Package info

github.com/billstack-app/oxid-module

Type:oxideshop-module

pkg:composer/billstack/oxid-module

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-30 19:03 UTC

This package is auto-updated.

Last update: 2026-12-01 08:29:59 UTC


README

Dieses Modul verbindet einen OXID eShop 6 mit Billstack. Es stellt im Shop eine Schnittstelle bereit, über die Billstack

  • neue und geänderte Bestellungen abholt,
  • den Versand mit Sendungsnummer zurückmeldet (auf Wunsch mit der Versandmail des Shops, je Bestellung genau einmal),
  • Bestände von Artikeln und Varianten setzt,
  • Artikel und Varianten liest, alle seitenweise oder einen einzelnen mit seinen Varianten (Texte, Preis, Steuersatz, Bestand, EAN, Bilder),
  • Titel, Kurztext, Langtext und Preis bestehender Artikel ändert.

Neue Artikel legen Sie weiter im OXID-Admin an. Das Modul ruft selbst keine fremden Adressen auf und sendet keine Nutzungsdaten. Es antwortet nur auf Anfragen, die den Schlüssel aus den Moduleinstellungen mitschicken.

Voraussetzungen

  • OXID eShop 6.1 bis 6.5, Community oder Professional Edition
  • PHP 7.1 oder neuer
  • Installation per Composer im Shop
  • Der Shop ist öffentlich über https:// erreichbar

Nicht unterstützt: OXID eShop 6.0 und 7, Subshops der Enterprise Edition, eine zweite Shopsprache (das Modul arbeitet immer in der Standardsprache des Shops).

Installation

  1. Im Hauptverzeichnis des Shops (dort, wo die composer.json des Shops liegt):

    composer require billstack/oxid-module
  2. Im OXID-Admin unter Erweiterungen > Module den Eintrag Billstack Connector öffnen und Aktivieren klicken.

    Ab OXID 6.2 geht das auch auf der Konsole:

    vendor/bin/oe-console oe:module:activate billstack_connector

    Erscheint das Modul ab OXID 6.2 nach composer require nicht in der Liste, die Modulkonfiguration nachinstallieren (Befehl aus der OXID-Dokumentation, Abschnitt Troubleshooting):

    vendor/bin/oe-console oe:module:install-configuration source/modules/billstack/connector
  3. Beim ersten Aktivieren erzeugt das Modul einen zufälligen Schlüssel mit 40 Zeichen.

Den Schlüssel finden

Im OXID-Admin unter Erweiterungen > Module > Billstack Connector, Reiter mit den Moduleinstellungen, Gruppe Billstack, Feld API-Schlüssel. Diesen Wert zusammen mit der Shop-Adresse in Billstack beim Verbinden des Shops eintragen.

Sie können den Schlüssel jederzeit durch einen eigenen ersetzen. Er muss mindestens 32 Zeichen lang sein, sonst lehnt das Modul jede Anfrage ab. Nach einer Änderung den neuen Schlüssel auch in Billstack eintragen. Ein vorhandener Schlüssel bleibt beim erneuten Aktivieren erhalten.

Entfernen

  1. Das Modul im Admin unter Erweiterungen > Module > Billstack Connector deaktivieren, ab OXID 6.2 alternativ:

    vendor/bin/oe-console oe:module:deactivate billstack_connector
  2. Das Paket entfernen:

    composer remove billstack/oxid-module
  3. Ab OXID 6.2 entfernt das OXID-Composer-Plugin dabei laut OXID-Dokumentation auch die Modulkonfiguration. Bleibt sie stehen, gibt es ab OXID 6.2.3 den Befehl:

    vendor/bin/oe-console oe:module:uninstall-configuration billstack_connector

    Bleibt der Ordner source/modules/billstack/connector danach bestehen, kann er gelöscht werden.

  4. Die Verbindung in Billstack trennen.

Lizenz

GPL-3.0-only, siehe LICENSE.

API contract v1 (English)

Endpoint and authentication

https://<shop>/index.php?cl=billstack_api&fnc=<action>&skipSession=1
  • Every request sends the key in the header X-Billstack-Key. The module compares it with hash_equals. When the stored key is empty or shorter than 32 characters, every request is rejected.
  • A wrong or missing key gives HTTP 401 with exactly {"error":"unauthorized"}. The key is checked before the action, so unknown actions also answer 401 without a valid key.
  • skipSession=1 is recommended: OXID then does not start a frontend session. The module also strips Set-Cookie from its responses.
  • If the module is not active, OXID does not know the controller and redirects to the start page (HTML). Callers should treat any non-JSON answer as "module not reachable".

Response conventions

  • Every response is JSON with Content-Type: application/json; charset=utf-8, and the request ends there; no shop template is rendered.
  • Money: string with exactly two decimals ("12.30"), never a JSON number. Values are the stored OXID doubles, rounded to two decimals.
  • VAT rates: string with two decimals ("19.00"), or null when the column is NULL.
  • Quantities, stock and weight: string without trailing zeros ("2", "1.5"), because OXID stores them as doubles.
  • Times: ISO-8601 in UTC ("2026-11-30T09:30:00Z"). OXID writes DATETIME columns in the shop's PHP time zone (date_default_timezone_set in config.inc.php); the module converts with that zone. OXID's empty dates (0000-00-00 00:00:00, 0000-00-00) are null. bill_date is a calendar date YYYY-MM-DD.
  • Countries: ISO 3166-1 alpha-2 from oxcountry.OXISOALPHA2, never the internal country id.
  • Texts are in the shop's default language (sDefaultLang).

Errors

HTTP error When
401 unauthorized key missing, wrong, or no usable key stored
404 unknown_action fnc is not one of the actions below
404 order_not_found, product_not_found id does not exist in this shop
405 method_not_allowed wrong HTTP method; body has allowed, header Allow
422 see each action validation failure; some errors carry extra keys (max, max_length, fields, trans_status)
500 internal_error unexpected failure; details go to the shop log only

Common 422 codes: invalid_json, body_too_large, unknown_field (with fields), invalid_limit (with max), invalid_cursor, invalid_since, invalid_id.

Paging

orders and products page with an opaque cursor:

  • First call without cursor. Optional since (Unix seconds) starts at that change time instead of the beginning; it is ignored when cursor is given.
  • limit: 1 to 100, default 100.
  • The answer carries next_cursor and has_more. Send next_cursor back unchanged. When a page is empty, next_cursor is the cursor that was sent (or null on a first call without since).
  • Order: change time ascending, then OXID. The change time comes from UNIX_TIMESTAMP(OXTIMESTAMP), so there is no time zone arithmetic while paging.
  • Rows changed during the current second are held back until the next call, so a row changed in the same second as the last delivered row cannot slip behind the cursor. A row that changes again later shows up again; callers must be idempotent.
  • orders: change time is oxorder.OXTIMESTAMP. products: the later of oxarticles.OXTIMESTAMP and oxartextends.OXTIMESTAMP (a long-text change counts).

Actions

ping (GET)

key type meaning
contract int contract version, 1
module_version string module version
shop_version string OXID compilation version, e.g. 6.1.3
edition string CE, PE or EE
php_version string
shop_id int
language int default language id the module works in
enter_net_price bool blEnterNetPrice: article prices are entered net
show_net_price bool blShowNetPrice: shop calculates baskets net (B2B)
default_currency string|null first entry of aCurrencies
default_vat_rate string|null dDefaultVAT
timezone string PHP time zone used for DATETIME columns
server_time string current time, UTC

orders (GET)

Parameters: cursor, since, limit. Answer: {"orders": [<order>...], "next_cursor": string|null, "has_more": bool}.

Every order of the shop is returned, including unfinished ones (trans_status other than OK) and cancelled ones.

order (GET)

Parameter: id (OXID of the order). Answer: {"order": <order>}.

Order object

key source
id OXID
order_number OXORDERNR (int; 0 while unfinished)
shop_id, user_id, language OXSHOPID, OXUSERID, OXLANG
order_date OXORDERDATE
updated_at OXTIMESTAMP
trans_status OXTRANSSTATUS (OK, NOT_FINISHED, ...)
cancelled OXSTORNO
folder OXFOLDER
paid_at OXPAID
shipped_at OXSENDDATE
tracking_code OXTRACKCODE as stored
tracking_codes OXTRACKCODE split at commas
is_net_mode OXISNETTOMODE
currency, currency_rate OXCURRENCY, OXCURRATE (decimal string)
remark OXREMARK
bill_number, bill_date OXBILLNR, OXBILLDATE
totals.order_sum OXTOTALORDERSUM
totals.brut_sum, totals.net_sum OXTOTALBRUTSUM, OXTOTALNETSUM
totals.voucher_discount, totals.discount OXVOUCHERDISCOUNT, OXDISCOUNT
totals.vat_rate_1, totals.vat_amount_1 OXARTVAT1, OXARTVATPRICE1
totals.vat_rate_2, totals.vat_amount_2 OXARTVAT2, OXARTVATPRICE2
delivery.type, delivery.name OXDELTYPE, delivery set title
delivery.cost, delivery.vat_rate OXDELCOST (gross), OXDELVAT (rate)
payment.type, payment.name OXPAYMENTTYPE, payment title
payment.cost, payment.vat_rate OXPAYCOST (gross), OXPAYVAT (rate)
payment.user_payment_id, payment.transaction_id, payment.pay_id, payment.xid OXPAYMENTID, OXTRANSID, OXPAYID, OXXID
wrapping.cost, wrapping.vat_rate OXWRAPCOST (gross), OXWRAPVAT (rate)
gift_card.id, gift_card.cost, gift_card.vat_rate OXCARDID, OXGIFTCARDCOST (gross), OXGIFTCARDVAT (rate)
vouchers[] number, series_id, discount from oxvouchers of this order
billing_address email (OXBILLEMAIL), company, salutation, first_name, last_name, street, street_number, additional_info, zip, city, country_iso2, state_id, phone, fax, vat_id (OXBILLUSTID)
delivery_address the raw OXDEL* block with the same keys (no email, no vat_id); empty strings when the buyer gave no separate address
has_delivery_address OXDELSTREET or OXDELCITY is not empty; otherwise the billing address is the delivery address
lines[] see below

Line object:

key source
id OXID of oxorderarticles
article_id, article_number OXARTID, OXARTNUM (not unique in OXID)
title, short_description, variant_selection OXTITLE, OXSHORTDESC, OXSELVARIANT
amount OXAMOUNT
unit_price_gross, unit_price_net OXBPRICE, OXNPRICE
line_gross, line_net, line_vat OXBRUTPRICE, OXNETPRICE, OXVATPRICE
vat_rate OXVAT
base_price OXPRICE
wrap_id OXWRAPID
is_bundle OXISBUNDLE
cancelled OXSTORNO

Notes on OXID's data model: all amounts are doubles; delivery, payment, wrapping and gift card costs are stored gross with a VAT rate column; the header has only two VAT slots; vouchers and basket discounts exist only on the header, line amounts stay undiscounted.

ship (POST)

JSON body:

key type required meaning
order_id string yes OXID of the order
tracking_code string|null no one code, no commas, at most 128 characters
shipped_at string no ISO-8601 with offset; default now
send_mail bool no send OXID's own shipping mail on the first shipment; default false

Behaviour: the first call sets OXSENDDATE (and the tracking code) through the OXID order model and sends the shipping mail when send_mail is true. A call for an order that already has a send date never changes the date and never sends a mail. A new, different tracking code is appended to OXTRACKCODE comma-separated; the same code twice changes nothing. When the appended list would exceed the 128 characters of OXTRACKCODE, nothing is stored and tracking_truncated is true.

Answer:

key type
order_id string
already_shipped bool, the order had a send date before this call
shipped_at string|null, stored send date
tracking_code string, stored OXTRACKCODE
tracking_codes string[]
tracking_added bool
tracking_truncated bool
mail_requested bool
mail_sent bool, OXID reported the mail as sent

422 codes: invalid_order_id, invalid_tracking_code, tracking_code_too_long (with max_length), invalid_shipped_at, invalid_send_mail, order_cancelled, order_not_finished (with trans_status). 404: order_not_found.

stock (POST)

JSON body: {"items": [{"id": "<article or variant OXID>", "stock": 12}, ...]}, 1 to 200 items, stock as number or numeric string, not negative, at most four decimals.

Every item is written through Article::reduceStock(), the OXID model method that also recalculates the parent's OXVARSTOCK for variants. An item whose stock already has the target value is not written.

Answer: {"results": [...]} in the order of the request. Each result has id and status:

status extra keys
ok changed (bool), previous_stock, stock
not_found
invalid_id, invalid_stock, invalid_item
duplicate_id the id appeared earlier in the same request; only the first is applied

422 codes for the whole request: no_items, too_many_items (with max).

products (GET)

Parameters: cursor, since, limit. Answer: {"products": [<product>...], "next_cursor": string|null, "has_more": bool}. Articles and variants, active and inactive.

key meaning
id, parent_id OXID, OXPARENTID (null for articles without parent)
article_number, ean OXARTNUM, OXEAN
title, short_description, long_description own values in the default language; variants usually leave them empty and show the parent's
price effective price: own OXPRICE, or the parent's when a variant has none; net when enter_net_price is true
price_inherited price comes from the parent
vat_rate effective rate as OXID resolves it (article, category, shop default)
vat_rate_own OXVAT, null when not set
stock, stock_flag OXSTOCK, OXSTOCKFLAG (1 standard, 2 offline when sold out, 3 not orderable when sold out, 4 external)
variant_stock, variant_count OXVARSTOCK, OXVARCOUNT on parents
weight OXWEIGHT in kg
active OXACTIVE
variant_name, variant_selection OXVARNAME (parent), OXVARSELECT (variant)
images absolute URLs of the master pictures 1 to 12 that exist
updated_at change time used for paging

product (GET)

Parameter: id (OXID of an article or variant). Answer: {"product": <product>, "variants": [<product>...]}.

  • product has exactly the keys and values of the item products returns for the same id (same reader, same inheritance rules).
  • variants: for a variant parent all its variants, in the order products returns them; for every other article, including a variant, an empty list. A variant comes back with its parent_id.
  • Like products, product returns active and inactive articles; check active.
  • Unlike products, an article changed during the current second is returned as well (no paging, nothing is held back).

Errors: 422 invalid_id (missing or malformed id), 404 product_not_found, 405 on any method other than GET.

product_update (POST)

JSON body: id (required) and at least one of title (max 255 characters), short_description (max 255 characters), long_description (max 65535 bytes, HTML allowed), price (string or number, at most two decimals, not negative, in the shop's entry mode). Only existing articles can be changed; new articles are created in the OXID admin.

The article is saved through the OXID article model in the default language. Answer: {"product": {"id", "title", "short_description", "long_description", "price", "updated_at"}} with the values as stored after the save, for the caller to compare.

422 codes: invalid_id, no_fields, invalid_title, title_too_long, invalid_short_description, short_description_too_long, invalid_long_description, long_description_too_long, invalid_price. 404: product_not_found.

Development

.github/workflows/contract.yml installs OXID 6.1.3 (PHP 7.3) and 6.5 (PHP 8.1) with demo data, seeds orders through OXID's checkout (tests/ci/seed.php) and runs tests/ci/contract-test.php against the module. The response bodies are uploaded as the artifact fixtures-<version>, the measured answers as findings-<version>.

OXID 6.1 needs Composer 1, for which packagist.org no longer serves metadata. The 6.1.3 shop is therefore installed from the lock file in tests/ci/shop-6.1.3/, generated with Composer 2 (composer update --no-install --no-plugins --no-scripts --ignore-platform-reqs, advisory blocking off). Regenerate it the same way when that composer.json changes.