# Test offline payments

Simulate network failures to test your offline payments integration without going physically offline.

> #### Get early access to offline mode testing on Stripe Terminal.
> 
> We support offline mode testing in [Private preview](https://docs.stripe.com/release-phases.md). If you’re interested in joining the preview, [share your email address to request access](https://docs.stripe.com/terminal/features/operate-offline/test-offline.md#signup).

### Get early access to offline mode testing on Stripe Terminal.

Enter your email to request access.

```bash
curl https://docs.stripe.com/preview/register \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Referer: https://docs.stripe.com/terminal/features/operate-offline/test-offline" \
  -d '{"email": "EMAIL", "preview": "terminal_offline_mode_preview"}'
```

The Terminal SDK includes a `simulatedOfflineModeConfiguration` property that lets you simulate network failures in test mode without physically disconnecting from the internet. Use this to verify your offline payments integration handles connectivity issues correctly.

> You can only use `simulatedOfflineModeConfiguration` in test mode. Setting a non-default configuration while connected to a livemode reader throws a `TerminalException` error.

## Before you begin

Make sure you:

- Have a working [offline payments integration](https://docs.stripe.com/terminal/features/operate-offline/collect-card-payments.md).
- Are operating in [test mode](https://docs.stripe.com/terminal/references/testing.md) with a reader.

> Tap to Pay on iPhone offline mode requires a **physical iPhone**. The simulated Tap to Pay reader can simulate card taps for online testing, but it doesn’t support offline mode. `simulatedOfflineModeConfiguration` also doesn’t simulate offline mode for Tap to Pay on iPhone.

## Configure simulated offline mode

The `SimulatedOfflineModeConfiguration` object has two properties that you can configure independently:

- `sdkOfflineMode`: Simulates network failures for calls made by the SDK itself.
- `readerOfflineMode`: Simulates network failures for calls made by smart readers with independent connectivity (such as WisePOS E or S700). This property is ignored for Bluetooth and USB readers because all network calls flow through the SDK for those reader types.

| Mode | Behavior |
| --- | --- |
| `DISABLED` | Default. No simulation. Uses real network conditions. |
| `OFFLINE_IMMEDIATE` | Requests fail instantly with a network error. |
| `OFFLINE_TIMEOUT` | Requests hang for 15 seconds then fail. Useful for testing retry and timeout logic. |
| `OFFLINE_INTERMITTENT` | Approximately 50% of requests fail randomly. Useful for testing retry behavior and partial connectivity scenarios. |

## Toggle simulated offline mode

#### iOS

```swift
// Enable simulated offline mode
Terminal.shared.simulatedOfflineModeConfiguration = SimulatedOfflineModeConfiguration.fullOffline

// Reset to normal network behavior after testing
Terminal.shared.simulatedOfflineModeConfiguration = SimulatedOfflineModeConfiguration.default
```

## Check reader network status

The `OfflineStatus` object lets you query the current network status of the SDK and the connected reader. You can read it directly at any time:

#### iOS

```swift
let networkStatus = Terminal.shared.offlineStatus.sdk.networkStatus
```

Or use the `OfflineDelegate` (iOS) or `OfflineListener` (Android, Java) to receive updates whenever the network status changes:

#### iOS

```swift
class CustomOfflineDelegate: OfflineDelegate {
    func terminal(_ terminal: Terminal, didChangeOfflineStatus offlineStatus: OfflineStatus) {
        let networkStatus = offlineStatus.sdk.networkStatus
        // Update your UI based on networkStatus
    }
}

Terminal.shared.offlineDelegate = CustomOfflineDelegate()
```

## See also

- [Collect card payments while offline](https://docs.stripe.com/terminal/features/operate-offline/collect-card-payments.md)
- [Test your Terminal integration](https://docs.stripe.com/terminal/references/testing.md)
