ECR Simulator
Last updated: 2026-03-22
Overview
The ECR Simulator is a demo point-of-sale application built into the sandbox. It simulates a Cinema concession stand with a real product catalog, a shopping cart, and a live checkout flow backed by actual Westpay Online API calls.
It is designed to demonstrate exactly the kind of ECR integration a merchant would build: selecting items, totalling an order, and sending a payment request to a physical (or virtual) terminal.
Configuration
Click Configure in the top-right to open the ECR Configuration dialog. This dialog has two tabs:
Authorization
| Field | API Header |
|---|---|
| Subscription Key | Ocp-Apim-Subscription-Key |
| Bearer Token | Authorization: Bearer <token> |
Enter your sandbox credentials and click Save & Continue to proceed to the Terminal tab.
Terminal
Simulation Mode
| State | Behaviour |
|---|---|
| ON (default) | Terminal ID, Connection ID, and Registration Code are all auto-synced from the Terminal Simulator. The Terminal Linking toggle is automatically set to match the simulator's current linked state. |
| OFF | All fields are entered manually. Registration Code must be a 6-digit code. |
When Simulation Mode is ON and the Terminal Simulator has not yet connected, the Registration Code field remains editable as a fallback so you can still proceed manually.
Terminal ID
When Simulation Mode is ON, this field is read-only and displays Auto-synced from simulator with the current value from the virtual terminal. The default terminal ID is 80000800.
When Simulation Mode is OFF, enter the terminal ID of the physical or virtual terminal you want to target.
Connection ID
The SignalR Connection ID from the Terminal Simulator session. When Simulation Mode is ON this is auto-filled. It is sent as the ConnectionId request header with every API call so the backend knows which simulator session to route the transaction to.
Terminal Linking
The toggle controls whether the next action is Link Terminal or Unlink Terminal.
When Simulation Mode is ON, the toggle is automatically set to the opposite of the simulator's current state:
- Simulator not linked → toggle set to Link Terminal
- Simulator linked → toggle set to Unlink Terminal
The Registration Code field behaves differently based on the mode:
- Simulation Mode ON + simulator connected: code is read-only, synced automatically from the code shown on the virtual terminal display
- Simulation Mode ON + simulator not yet connected: code field is editable with a hint
- Simulation Mode OFF: code field is always editable and requires manual 6-digit entry
Paying for an Order
- Add products to the cart
- Ensure the terminal is linked and configured
- Click Pay
<amount>kr at the bottom of the order panel
API Calls Made by the ECR Simulator
| Action | Endpoint | Method |
|---|---|---|
| Pay | /in-store/api/v1/purchase | POST |
| Link Terminal | /in-store/api/v1/terminal/link | POST |
| Unlink Terminal | /in-store/api/v1/terminal/unlink | POST |
| Poll Transaction Status | /in-store/api/v1/transaction/{refId}/status | GET |
All calls include the Ocp-Apim-Subscription-Key, Authorization, and ConnectionId headers automatically.
Purchase Request Body
json{ "amount": "25.00", "currencyCode": 752, "terminalId": "80000800", "paymentMethod": "" }
Amount is sent as a decimal string in
##.##format (e.g."25.00"). Currency code752is ISO 4217 for SEK.
Transaction Status Polling
After a successful purchase request the console polls GET /transaction/{refId}/status every 2 seconds until a terminal result is received:
transactionStatus value | Meaning |
|---|---|
14 | Pending — terminal is processing |
0 | Approved |
| Any other value | Declined |