Developers
Connect a stock app, an inventory tool or your own code to your All Affordable store. Push your products and stock in, and get told the moment something sells.
Getting started
- In your seller dashboard, open API / Connections and make a store key. It is shown once, so copy it straight into your app.
- Send every request to
https://www.allaffordable.shopwith the headerAuthorization: Bearer <your key>. Use this address exactly, withwww: the address without it redirects, and most HTTP clients drop the key on a redirect. - Add a webhook on the same page if you want to hear about orders as they happen.
A key works for one store, only while that store is approved. You can revoke it at any time; it stops working at once. Errors come back as JSON: { "error": "...", "detail": "..." }.
Products
PUT /api/v1/products/{product_id} creates or updates one product. product_id is your own id for it; we keep it as the product's external id.
PUT https://www.allaffordable.shop/api/v1/products/sk_123
{
"updated_at": "2026-11-27T20:15:00Z",
"title": "Christmas card, pack of 5",
"description": "Printed on recycled card.",
"condition": "new",
"category": "cards-and-stationery",
"currency": "GBP",
"images": ["https://your-app.example.com/img/sk_123-1.jpg"],
"variants": [
{ "sku": "XMAS-5", "price_pence": 799, "available": 40, "weight_g": 120 }
]
}
200 { "id": "…", "status": "live" }status is live, pending_review (a person looks at a new store's first products), rejected (with a reason) or withdrawn. Send { "deleted": true } to withdraw a product: it is hidden, never deleted. Prices are in GBP pence. A product we removed can't be brought back from an app.
Stock
PATCH /api/v1/stock sets the stock of up to 500 SKUs at once.
PATCH https://www.allaffordable.shop/api/v1/stock
{ "items": [ { "sku": "XMAS-5", "available": 38 } ] }
200 { "updated": 1, "unknown": [] }Categories
GET /api/v1/categories lists the category slugs you can use on a product.
200 { "categories": [ { "slug": "cards-and-stationery", "name": "Cards & Stationery", "parent": null } ] }Orders
GET /api/v1/orders?updated_since=<ISO date>&limit=50 returns your store's orders changed since that moment, oldest first. Unpaid orders are left out. Read it every few minutes as a safety net, in case a webhook was missed. Ask again with next_updated_since while has_more is true; an order can appear twice at the edge of two pages, so keep one per id.
200 {
"orders": [
{
"id": "6f1c…",
"status": "paid",
"currency": "GBP",
"created_at": "2026-11-27T20:30:11Z",
"updated_at": "2026-11-27T20:31:02Z",
"paid_at": "2026-11-27T20:31:02Z",
"delivered_at": null, "refunded_at": null, "cancelled_at": null,
"subtotal": 7.99,
"commission": 0.40,
"items": [
{ "product_id": "…", "external_id": "sk_123", "sku": "XMAS-5",
"title": "Christmas card, pack of 5", "quantity": 1,
"unit_price": 7.99, "subtotal": 7.99 }
]
}
],
"has_more": false,
"next_updated_since": "2026-11-27T20:31:02Z"
}Amounts are in pounds. Only your store's lines are included. We don't send the buyer's name or address here.
Webhooks
Add a webhook on API / Connections: an https address, a name, and the events you want. A store can have up to 5, one per app. We send a POST with a JSON body for each event, usually within a minute.
| Event | When |
|---|---|
| order.paid | The buyer has paid. Reduce your stock now. |
| order.delivered | The order reached the buyer (download ready, or parcel delivered). |
| order.completed | The order is closed. |
| order.disputed | The buyer opened a dispute. |
| order.refunded | The order was refunded. Put stock back if the item came back. |
| order.cancelled | The order was cancelled before it was fulfilled. |
| listing.status_changed | A product went live, was held for review, withdrawn or removed. |
| listing.stock_changed | The stock of a SKU changed on All Affordable. |
An order event carries the order in the same shape as the orders list:
{
"id": "0b6e…", // the delivery id, same as the webhook-id header
"type": "order.paid",
"timestamp": "2026-11-27T20:31:02Z",
"data": { "id": "6f1c…", "status": "paid", "items": [ … ], … }
}Listing events:
{ "type": "listing.stock_changed",
"data": { "product_id": "…", "sku": "XMAS-5", "stock": 37, "previous_stock": 38,
"stock_managed_by": "stock_keeper", "updated_at": "…" } }
{ "type": "listing.status_changed",
"data": { "product_id": "…", "external_id": "sk_123", "title": "…",
"status": "active", "previous_status": "pending_review", "updated_at": "…" } }Checking signatures
Every delivery is signed the Standard Webhooks way, with the secret you got when you made the webhook (it starts with whsec_). Each request has three headers:
webhook-id: unique per delivery. Use it to ignore repeats.webhook-timestamp: seconds since 1970. Refuse anything older than 5 minutes.webhook-signature:v1,<base64>, the HMAC-SHA256 ofid.timestamp.body, keyed with the base64-decoded part of the secret afterwhsec_.
In Node.js:
import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret, headers, rawBody) {
const id = headers["webhook-id"];
const ts = Number(headers["webhook-timestamp"]);
if (Math.abs(Date.now() / 1000 - ts) > 300) return false;
const key = Buffer.from(secret.slice("whsec_".length), "base64");
const expected = createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest("base64");
return headers["webhook-signature"].split(" ").some((part) => {
const [version, sig] = part.split(",");
return version === "v1" && sig.length === expected.length &&
timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
});
}Check the signature on the raw body, before parsing it. Any Standard Webhooks library works too.
Retries and testing
Answer with any 2xx within 10 seconds. Anything else counts as a failure, and we try again after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours and 10 hours, then stop. Do the slow work after you answer. Redirects are not followed.
Send test event next to each webhook sends a ping at once, so you can see your endpoint answer before a real order arrives. The page shows the last answer we got.