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.

Sequence diagram of a payment: the POS iOS App opens a WebSocket to the Payment SPI Server and receives a CONNECTED event, then POSTs a payment over REST (mTLS + HMAC). The proxy makes a gateway SDK call to the Payment Terminal, then streams real-time terminal events (card inserted, PIN entry, authorization progress) back to the client over the WebSocket while the cardholder interacts with the terminal. Finally, the terminal returns an authorization result to the proxy, which returns the final REST response to the client.

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:

  1. The client opens a WebSocket to WSS /events?transactionId={transactionId} and waits for a CONNECTED event.
  2. The client calls POST /payment with the same transactionId.
  3. The proxy drives the terminal and streams events back over the WebSocket.
  4. 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}/status
  • POST /api/v1/payment
  • GET /api/v1/payment/{transactionId}: Recovers a transaction after a timeout or crash.
  • POST /api/v1/payment/{transactionId}/cancel
  • POST /api/v1/payment/{transactionId}/void
  • POST /api/v1/refund
  • GET /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.

OperationTimeout
Initial connection10s
Payment120s
Payment + recovery300s
Status query30s
Health check5s
Cancel / Void30s
Refund120s
Gift Card Balance30s
Gift Card Operation60s
Gift Card Payment120s
Card Acquisition120s
Terminal Display10s
Terminal Input120s
PBL Create30s
PBL Expire15s
PBL Status Query15s
PBL Refund/Void120s
SAF Query15s
Offline Validation30s
Terminal Offline Status5s

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 .local hostnames 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.

FieldRequiredValue
SPI Proxy Base URLYesThe 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 URLNoThe proxy’s WebSocket URL. If you enter a value, it must begin with wss://.
Gateway IdentifierYesA free-text label that identifies the payment gateway that your proxy supports, such as worldpay or adyen.
Security ModeYesSecure (default) for production, or Simple for development and testing only.
Pinned Certificate HashIn Secure modeThe SHA-256 hash of the proxy’s TLS certificate, as a 64-character hex string.
HMAC SecretIn Secure modeA Base64-encoded HMAC key of at least 32 bytes.
Offline Payment ModeNoNone (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 of https://
  • 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.