This feature is experimental
Introduction
Offline payments enable business users and customers to complete transactions when neither business user nor customer has an internet connection.
The Vipaso SDK implements offline payments through a pre-authorization mechanism, allowing customers to allocate funds for offline use while they have internet connectivity.
Overview
Pre-authorization
For customers to make payments without an internet connection, they must have a pre-authorized balance on their payment instrument. Pre-authorization is a process where customers allocate a specific amount of funds while online that can later be spent when offline.
A pre-authorized instrument is required before any offline payment can be processed. Without this pre-authorization, offline payments will not be possible.
To implement pre-authorization in your application:
let request = PreAuthorizationRequest(
instrumentID: instrumentID,
amount: amount,
currency: currency
)
vipaso.payment.customer.instrument.preAuthorizeInstrument(request: request) { result in
switch result {
case .success(let response):
promise(.success(response.authorization))
case .failure(let error):
promise(.failure(.generic(error: error)))
}
}
Example screenshots from our development application:

Offline Payment Flow
For payment setup and processing, refer to the Online Payment Use Case, as the flow is identical. The primary difference is that offline payments require pre-authorization when neither party has internet access.
Offline payment synchronization
On iOS, locally stored offline payments must be synchronized with the backend. Fetch the payments using fetchOfflinePayments
and then synchronize them:
let offlinePayments = vipaso.payment.customer.fetchOfflinePayments()
Then you can use syncPayments
to synchronize them with the backend.
vipaso.payment.customer.syncPayments { result in
switch result {
case .success:
print("Offline payments synchronized successfully")
case .failure(let error):
print("Sync failed: \(error.localizedDescription)")
}
}