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.
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.
- If the response contains
status: "PairedConnected"
andflow: "Idle"
...- Perform the transaction, e.g. a purchase transaction.
- Else, if
status
orflow
has a different status ...- Spice is not ready to perform a transaction. Do not perform the transaction and instead display an error message relevant to the status.
- Else, if there is no response ...
- 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.”
- Spice is either not running, not connected, or has an unexpected error.
Remember:
Each request must include the
POS-Name
andPOS-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
Updated about 1 year ago