Ping test

Before each transaction, a ping test should be performed to check that the Spice payment adaptor is running and ready to make the transaction.

Perform a ping test and validate the response

We recommend that your Spice integration perform a ping test before each transaction. By doing so, you will make sure that Spice is ready to handle the transaction, and hence you can reduce the potential for connectivity issues.

For this purpose, Spice provides the GET /v1/ping endpoint.

Sequence diagram of a ping test.

The response indicates whether Spice is running and ready to make a transaction. Your Spice integration should validate the response to determine whether to make the transaction, and you can use logic similar to the following.

  1. If the response contains status: "PairedConnected" and flow: "Idle" ...
    1. Perform the transaction, e.g. a purchase transaction.
  2. Else, if status or flow has a different status ...
    1. Spice is not ready to perform a transaction. Do not perform the transaction and instead display an error message relevant to the status.
  3. Else, if there is no response ...
    1. Spice is either not running, not connected, or has an unexpected error.
      Do not perform the transaction and instead display a relevant error message on your POS, such as
      “Transactions cannot be made because Spice is not responding.”

📘

Remember:

Each request must include the POS-Name and POS-Version HTTP headers.

  • The POS-Name must be your business name.
  • The POS-Version must be the current version of your POS. (You should set this dynamically so it is always up to date with the current version.)
POS-Name: Example Company
POS-Version: 1.0.0