Bonus System

Admin API

Who is this guide for?

For you as a shop owner if you want to connect the Bonus System to another system — an ERP, a CRM or a POS system — and for developers who want to read or book points from outside Shopware.

What the Admin API is

The Admin API is the interface the Shopware Administration uses to talk to the server. The Bonus System uses it completely — right after installation, without any configuration on your side. Saving, editing and viewing in the admin module runs on it.

Entities

The plugin's data are regular Shopware entities. Shopware exposes the CRUD endpoints for them automatically and documents them in your shop:

  • /api/_info/stoplightio.html#/schemas/PremsBonusSystemUserPoint — a customer's point account
  • /api/_info/stoplightio.html#/schemas/PremsBonusSystemBooking — bookings
  • /api/_info/stoplightio.html#/schemas/PremsBonusSystemCondition — conditions
  • /api/_info/stoplightio.html#/schemas/PremsBonusSystemBonusProduct — bonus products
  • /api/_info/stoplightio.html#/schemas/PremsBonusSystemImportPoint — import table for the migration

Do not write point accounts through the entity directly. Use the booking endpoints instead — only then a traceable booking is created and the Flow Builder trigger Bonus points changed fires.

Endpoints of the Bonus System

All endpoints require a valid admin API token (POST /api/oauth/token). A full example including a Postman collection is available under Updating customer points with API.

Method Path Purpose
POST /api/v2/prems-bonus-system/create-bonus-booking Book points by customer number. Body: customerNumber, points (positive or negative), description, optionally salesChannelId.
POST /api/_action/prems/create-bonus-booking-by-customer-id Book points by customer ID. Body: customerId, points, description, optionally salesChannelId.
GET /api/v2/prems-bonus-system/get-bonus-points/{customerNumber} Read the current balance for a customer number.
GET /api/prems-bonus-system/get-bonus-points-by-customer-id/{customerId} Read the current balance for a customer ID.
GET /api/v2/prems-bonus-system/get-bonus-bookings/{customerNumber} Read a customer's bookings, optionally narrowed with the parameters startDate and endDate.
POST /api/prems-bonus-system/get-points-expire-in-days Read points that expire soon. Body (all optional): customerNumber or customerId, days, limit, offset.
POST /api/prems-bonus-system/reset-bonus-bookings Reset point accounts — optionally for one customer via customerNumber, with description as the booking reason.

reset-bonus-bookings resets balances and cannot be undone. Without customerNumber the call affects all customers. Back up first and try it on a staging system.

Permissions

For access through an integration or a user role, the privileges for the Bonus System entities must be granted. If you cannot save points in the admin module or lists stay empty, a privilege in the user role is usually missing.

Alternatives: bookings via flow or export

In this section