How to subscribe

Introduction

To receive webhooks you need to subscribe. When you subscribe, you need to supply a Subscription ID. This Subscription ID will be added to the header of every call made to your endpoint URL, so you can make a clear separation between different MplusKASSA installations.

Example of header:

Subscribe through the MplusKASSA Software

The backend of the MplusKASSA Software can be used to manage webhook subscriptions. When creating a subscription, you need to provide the following details:

  • Subscription ID: You can choose this value yourself. It does not have to be unique. You can use it to identify incoming calls.
  • Endpoint URL: The URL you want to send all webhook calls to. This URL will be used as a base URL, the specific event will be added to the URL
  • Secret Key: This key is used to verify the HMAC signature. It is never transmitted through webhook calls.

Besides that, you must also select the events you want to receive. Currently, we support the following events:

  • startSession – A new session is started.
  • scanCode – A code is scanned.
  • addSessionLine – A line is added to the session.
  • removeSessionLine – A line is removed from the session.
  • pauseSession – The session is moved to a queue, table or other kind of background status.
  • resumeSession – The session is restored from a queue, table or other kind of background status.
  • startPayment – Payment is about to take place.
  • cancelPayment – Payment has been canceled.
  • mergeSession – The session has been merged with another session. This session will not be used again.
  • cancelSession – The session has been canceled. This session will not be used again.
  • completeSession – The session has been paid and completed. This session will not be used again.

Finally, some events require extra configuration. These are:


  • Blocking or non-blocking: Whether or not MplusKASSA should wait for a reply from your endpoint URL. You can use this to influence the user flow with dialog options or to guarantee that a process on your end has completed.
  • Code triggers (type and pattern): You do not have to receive each scanned code by default. For example, if you know your codes are always going to be QR codes and they will always match a certain pattern, you can define that here.

Subscribe through the MplusKASSA API

A special API function called subscribeToEvents can be used to manage subscriptions programmatically.