Integrate Payment Gateways Using the Payment Gateway SPI
The Point of Sale (POS) Payment Gateway SPI lets you integrate third-party payment gateway terminals (for example, Worldpay or Stripe Terminal) with POS through a store-local proxy server. Implement the SPI on a proxy that runs on the store’s local network and acts as an intermediary between the POS iOS client and the payment gateway terminals. The proxy handles terminal communication, gateway protocol translation, and real-time event streaming so that new gateway integrations can be added without modifying the POS iOS application.
You build and host the proxy for your payment gateway. Salesforce doesn’t provide a proxy, sample code, or a reference implementation.
For endpoint details, see Payment Gateway SPI in the Point of Sale reference documentation.
For a comprehensive list of Point of Sale APIs and SPIs, see Point of Sale API, SPI, and Webhook Overview.
This diagram shows a payment for a client that uses the WebSocket channel.

The proxy exposes two channels that run side by side:
- REST over mTLS + HMAC-SHA256: The command channel. The POS iOS client uses this to start, cancel, and query transactions. The REST response is the source of truth for a transaction’s outcome.
- WebSocket: The event channel. Long-lived and optional. The client uses events to render real-time UI updates as the cardholder interacts with the terminal (for example,
CARD_INSERTED,PIN_ENTRY_STARTED,AUTHORIZATION_APPROVED).
The client generates a transactionId (UUID v4) per payment and uses it as the correlation ID across the WebSocket stream, the REST call, and any follow-up operations (cancel, void, capture, status query).
When the client uses the WebSocket channel, the payment flow follows this sequence:
- The client opens a WebSocket to
WSS /events?transactionId={transactionId}and waits for aCONNECTEDevent. - The client calls
POST /paymentwith the sametransactionId. - The proxy drives the terminal and streams events back over the WebSocket.
- The proxy returns the final authorization result in the REST response.
The WebSocket channel is optional. Support clients that skip it and rely on the REST response alone.
The proxy streams live terminal events over the WebSocket channel during payments, gift card payments, and card acquisition. The channel also streams Pay By Link status updates. Without the WebSocket channel, the cashier doesn’t see intermediate updates, and the REST response is still the source of truth.
The WebSocket connection shares the REST TLS session, so the same pinned certificate and client certificate rules apply. The WebSocket port can differ from the REST port.
The proxy supports two security modes:
- Secure mode (production): Requires mTLS transport and HMAC-SHA256 request signing.
- Simple mode (testing only): No mTLS and no HMAC. Self-signed certificates are accepted.
For the HMAC message format, required headers, response signing, and nonce requirements, see the hmacAuth security scheme. For client certificate and server certificate pinning requirements, see the mtls security scheme.
The Payment Gateway SPI reference lists the endpoints by functionality. Which endpoints are required depends on the functionality that your stores need. Sales are the minimum functionality, so implement at least these endpoints. Other endpoints can also be required.
GET /api/v1/terminal/{terminalId}/statusPOST /api/v1/paymentGET /api/v1/payment/{transactionId}: Recovers a transaction after a timeout or crash.POST /api/v1/payment/{transactionId}/cancelPOST /api/v1/payment/{transactionId}/voidPOST /api/v1/refundGET /api/v1/health: Reports the health of the proxy itself.- The endpoints tagged Offline, if you plan to take payments offline.
All date and time fields use ISO 8601 format. The proxy server must accept both:
- Standard format:
2026-03-12T14:04:06Z - Fractional seconds:
2026-03-12T14:04:06.206Z
The server should return dates with fractional seconds for maximum precision.
The POS iOS client enforces per-operation timeouts. If the proxy doesn’t respond within the window listed below, the client treats the request as failed.
| Operation | Timeout |
|---|---|
| Initial connection | 10s |
| Payment | 120s |
| Payment + recovery | 300s |
| Status query | 30s |
| Health check | 5s |
| Cancel / Void | 30s |
| Refund | 120s |
| Gift Card Balance | 30s |
| Gift Card Operation | 60s |
| Gift Card Payment | 120s |
| Card Acquisition | 120s |
| Terminal Display | 10s |
| Terminal Input | 120s |
| PBL Create | 30s |
| PBL Expire | 15s |
| PBL Status Query | 15s |
| PBL Refund/Void | 120s |
| SAF Query | 15s |
| Offline Validation | 30s |
| Terminal Offline Status | 5s |
Host one proxy per store on the store’s local area network (LAN). Use a store PC, a dedicated device, or any other always-on machine. Use more than one proxy only for large stores that span multiple floors.
Host the proxy in the store for these reasons:
- Terminals are discoverable only on the store LAN.
- When Offline Payment Mode is Terminal SAF (Store and Forward) or Partial Offline, card payments continue during an internet outage, as long as the iPads, the proxy, and the terminals share the store LAN. When Offline Payment Mode is None, the default, the POS app blocks card payments while the store is offline.
Cloud hosting is out of scope for the Payment Gateway SPI. The POS app accepts any https:// URL, but a cloud-hosted proxy can’t take payments offline or discover in-store terminals.
Give the proxy a stable address. iPads read the address from Point of Sale CMS, so if the address changes, the iPads can’t connect to the proxy.
- A static IP address or a DHCP reservation is the most reliable option.
- A DNS hostname also works if the store’s DNS resolves it for every iPad.
- Avoid
.localhostnames unless multicast DNS (mDNS) works across the store network.
The proxy’s TLS certificate must include the exact IP address or hostname from the proxy URL as a subject alternative name (SAN).
To connect POS to the proxy, add a payment gateway of type PAYMENTSPI in Point of Sale CMS, and enter these values.
| Field | Required | Value |
|---|---|---|
| SPI Proxy Base URL | Yes | The proxy’s REST URL, in the format https://<address>:<port>. For example, https://10.0.0.25:8443 or https://spi.store123.example.com:8443. |
| SPI WebSocket URL | No | The proxy’s WebSocket URL. If you enter a value, it must begin with wss://. |
| Gateway Identifier | Yes | A free-text label that identifies the payment gateway that your proxy supports, such as worldpay or adyen. |
| Security Mode | Yes | Secure (default) for production, or Simple for development and testing only. |
| Pinned Certificate Hash | In Secure mode | The SHA-256 hash of the proxy’s TLS certificate, as a 64-character hex string. |
| HMAC Secret | In Secure mode | A Base64-encoded HMAC key of at least 32 bytes. |
| Offline Payment Mode | No | None (default), Terminal SAF (Store and Forward), or Partial Offline. |
Construct the SPI Proxy Base URL according to these requirements:
- Use
https://. - Include the port that the proxy listens on.
- Use an IP address or hostname that exactly matches a SAN in the proxy’s TLS certificate.
- Exclude the path. The POS app appends
/api/v1/...to the URL.
Set a default SPI Proxy Base URL for the tenant, and optionally override it for individual stores.
If any value is invalid, the POS app rejects the entire payment gateway configuration, and the cashier sees a “Payment SPI not configured” error. Common causes include:
- An
http://SPI Proxy Base URL instead ofhttps:// - A non-empty SPI WebSocket URL that doesn’t begin with
wss:// - An HMAC Secret that isn’t valid Base64
- An empty Gateway Identifier
- A missing Pinned Certificate Hash or HMAC Secret in Secure mode
iPads receive the configuration when they refresh the store configuration, which requires an internet connection the first time. After that, payments run over the store LAN using the cached configuration.