FILTER BY TAG

Store and Forward Offline Transactions

Use this information to use the Store and Forward feature to process offline sale and stand-alone credit transactions when an internet connection is not available.
WARNING
Using offline transaction payment services involves risk. Because these transactions are not authorized in real time, you assume responsibility for potential issues such as failed transactions, increased fraud, and higher chargeback rates. Only use offline transactions when necessary such as during temporary internet outages. Whenever possible, it is recommended to process online sale transactions to ensure secure and immediate authorization.
IMPORTANT
Store and Forward requires iOS 18.4 or later.

Offline Sale

Use this information to process a Store and Forward offline sale transaction. This transaction combines an authorization and a capture into a single transaction. When an internet connection is not available, the transaction is stored offline.
Stored offline transactions must be submitted for authorization when an internet connection is available.
WARNING
Whenever possible, process online sale transactions to ensure secure and immediate authorization. Using offline transaction payment services involves risk. Because these transactions are not authorized in real time, you assume responsibility for potential issues.
  1. Create the offline payment service.
  2. Create a
    ChargeParameters
    object for the offline sale.
  3. Call
    startChargeTransaction(with:)
    to store the sale transaction offline.
    // Throws MposUIReaderError.notActivated if device is not activated let offline = try await reader.mposUIOffline() let chargeParameters = ChargeParameters(amount: Decimal(1.00), currency: .USD, customIdentifier: "yourReferenceForTheTransaction") let result = await offline.startChargeTransaction(with: chargeParameters) switch result { case .offlineSuccess(let offlineTransaction): print("Stored offline. ID: \(offlineTransaction.id), amount: \(offlineTransaction.amount)") case .failure(let error): print("Transaction failed: \(error)") @unknown default: break }

Offline Stand-Alone Credit

Use this information to process a Store & Forward offline stand-alone credit transaction. When an internet connection is not available, the transaction is stored offline.
Stored offline transactions must be submitted for authorization when an internet connection is available.
  1. Create the offline payment service.
  2. Create a
    RefundParameters
    object for the offline stand-alone credit.
  3. Call
    startStandaloneRefundTransaction(with:)
    to store the stand-alone credit transaction offline.
    // Throws MposUIReaderError.notActivated if device is not activated let offline = try await reader.mposUIOffline() let refundParameters = RefundParameters(amount: Decimal(1.00), currency: .USD, customIdentifier: "yourReferenceForTheTransaction") let result = await offline.startStandaloneRefundTransaction(with: refundParameters) switch result { case .offlineSuccess(let offlineTransaction): print("Refund stored offline. ID: \(offlineTransaction.id)") case .failure(let error): print("Refund failed: \(error)") @unknown default: break }

Check Offline Transactions Batch Status

Use this information to retrieve a summary of Store and Forward offline transactions that are pending submission. The summary shows how many transactions are pending upload, when the session expires, and the cumulative (total monetary) amount of the stored transactions.
The offline session is valid for 24 hours after the last online transaction is complete. If the offline session expires, the device must go online before you can continue to perform Store and Forward transactions. The SDK refreshes the offline session automatically when the Store and Forward component initializes on an activated device (for example, after app launch), when an online transaction is performed, or when the integrator calls the
syncSession()
method.
When the device is rebooted or the passcode is turned off and on, the offline session becomes invalid. To refresh the offline session, the device must go online and perform an online transaction. After the online transaction is complete, the SDK uses the same automatic refresh behavior described for expired sessions.
  1. Use the offline payment service to verify the status of the offline transactions batch.
    // Throws MposUIReaderError.notActivated if device is not activated let offline = try await reader.mposUIOffline() let session = await offline.getSession() print("Pending transactions: \(session.transactionCount)") print("Session expires: \(session.expirationDate)") print("Cumulative amount: \(session.cumulativeAmount)")

Retrieve Offline Transactions Pending Submission

Use this information to retrieve a list of Store and Forward offline transactions that are pending submission for authorization.
  1. Use the offline payment service to retrieve the list of offline transactions that are pending submission.
    // Throws MposUIReaderError.notActivated if device is not activated let offline = try await reader.mposUIOffline() let transactions = offline.getTransactionList() for tx in transactions { print("[\(tx.type)] \(tx.amount) \(tx.currency) — \(tx.date)") }

Submit Offline Transactions Batch for Authorization

Use this information to submit a batch of Store and Forward offline transactions for authorization.
After processing offline transactions, submit them for authorization as soon as an internet connection is available. Transactions remain stored locally until they are successfully uploaded.
IMPORTANT
The device must have an internet connection before calling the
syncSession()
method, as shown in the code example.
  1. Confirm that an internet connection is available.
  2. Create the offline payment service.
  3. Call the
    syncSession()
    method to submit the offline transactions batch for authorization.
    // Throws MposUIReaderError.notActivated if device is not activated let offline = try await reader.mposUIOffline() let result: SyncSessionResult = await offline.syncSession() switch result { case .success: print("Batch session refreshed.") case .failure(.notActivated): print("Device not activated.") case .failure(.sessionInvalidated): print("Session invalidated — re-authenticate.") case .failure(.other(let developerInfo)): print("Sync failed: \(developerInfo)") }