# Server collect

POST /api/collect JSON for purchase or goal from a backend after the processor confirms. Same endpoint as the snippet. visitor_id is required. This is the Payment API stand-in. No Stripe or Paystack OAuth.

If you omit session_id on purchase or goal, collect stores srv-{visitor_id}. That is not the browser tab session. Amount is rand.

```js
const res = await fetch("https://www.zarstat.co.za/api/collect", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    type: "purchase",
    site_id: "YOUR_SITE",
    visitor_id: order.visitor_id,
    amount: 199,
    currency: "ZAR",
    reference: order.reference,
  }),
});
```

HTML twin: https://www.zarstat.co.za/docs/collect
