SPXRK

SPXRK API documentation

A developer quick start covering test keys, catalogue access, order creation, idempotency, errors and webhook signatures.

Get a test key

Enable test mode in the account’s API and webhooks settings. Store the spk_test_… key in SPXRK_API_KEY on your server. Catalog and status lookups require orders:read. Order creation requires orders:write. X-API-Key is also supported. The key determines the execution environment.

Select a product

GET /v1/categories lists catalog categories and groups. Read data[].sku in the product listing. Set offset to next_offset for each subsequent page until next_offset is null. Page sizes range from 1 to 200. Prices and availability depend on the account and time of the request.

curl --fail-with-body --max-time 15 \
  -H "Authorization: Bearer ${SPXRK_API_KEY:?}" \
  'https://spxrk.org/v1/products?group=giftcards&limit=20'

Prepare the order

For a gift card, save the object below to order.json and substitute a SKU from the test catalog. For top-ups, read GET /v1/products/{sku} and populate delivery from attributes.fields using options[].value. If validation is supported, send the same delivery to POST /v1/products/{sku}/validate. A null valid value is inconclusive. A UID format check alone cannot establish account ownership.

{"items":[{"sku":"<SKU_FROM_TEST_CATALOG>","quantity":1}]}

Create one sandbox order

Persist a unique CHECKOUT_ID and the exact body in your system before the first POST. Use a fresh ID for each new purchase. The example requires a test key. HTTP 201 accepts a new order. HTTP 200 on replay returns the existing order. Save its id from the response JSON. Check the final state before fulfilling the purchase.

case "${SPXRK_API_KEY:-}" in spk_test_*) ;; *) exit 2 ;; esac
curl --fail-with-body --max-time 15 \
  -H "Authorization: Bearer $SPXRK_API_KEY" \
  -H "Idempotency-Key: ${CHECKOUT_ID:?}" \
  -H 'Content-Type: application/json' \
  --data-binary @order.json https://spxrk.org/v1/orders

Check fulfillment

Set SPXRK_ORDER_ID to the returned id. The states created, routing and dispatched are intermediate. On fulfilled, process result once. On failed or cancelled, reconcile the state and charge. Space out polls and honor Retry-After.

curl --fail-with-body --max-time 15 \
  -H "Authorization: Bearer ${SPXRK_API_KEY:?}" \
  "https://spxrk.org/v1/orders/${SPXRK_ORDER_ID:?}"

Handle an error

Record the HTTP status, error.code and X-Request-Id. For 401/403 check the key and scopes, for 402 check the balance and for 422 correct fields or recipient details. For 409 inspect error.code. Honor Retry-After with 429 and 503. A POST timeout leaves the outcome unknown. Replay the persisted body with the original idempotency key. Bound retries and elapsed time.

Receive an order event

Configure an HTTPS order handler in the account and use its signing secret. X-Spxrk-Signature contains t and v1. Require the timestamp to be within 300 seconds and verify the HMAC-SHA256 of ASCII(t), a literal dot and the raw HTTP body with a constant-time comparison. Check X-Spxrk-Event-Id and X-Spxrk-Event against id and type in the signed JSON. Commit a unique event ID and its pending job in one transaction, then return 2xx. Acknowledge an already committed duplicate with 2xx. Reconcile out-of-order updates with GET /v1/orders/{order_id}.

Integration examples

SDK · Python / TypeScript

Download the SDK archive and verify its SHA-256 checksum before installing it in your server project.