Skip to main content
Version: iOS-8.1.2

iOS Business Payment APIs

Business payment APIs for sending payment requests, canceling transactions, and accessing payment records. Access these APIs through vipaso.payment.business.

Payment Processing

Send Payment Request via BLE

Initiate a payment request that can be received by nearby customer devices via Bluetooth Low Energy:

vipaso.payment.business.sendPaymentRequestViaBLE(
amount: "25.50",
currency: "USD",
paymentReference: "order-123" // Optional
) { result in
switch result {
case .success(let response):
// Payment request sent successfully
// Handle payment response based on status
handlePaymentResponse(response)
case .failure(let error):
print("Payment request failed: \(error.localizedDescription)")
}
}

Cancel Payment

Cancel an ongoing BLE payment request:

vipaso.payment.business.cancelPayment()
// This notifies connected customer devices that the payment is cancelled

Stop BLE

Stop the BLE payment service and disconnect all connections:

vipaso.payment.business.stopBLE()
// Call this when closing the app or when no longer accepting payments

Payment History

Fetch Payments

Retrieve a paginated list of payment transactions with status filtering:

vipaso.payment.business.fetchPayments(
page: 0,
status: .completed
) { result in
switch result {
case .success(let response):
let payments = response.payments
// Display payment list
displayPayments(payments)
case .failure(let error):
print("Fetch payments failed: \(error.localizedDescription)")
}
}

Fetch Payment Details

Get detailed information for a specific payment:

let request = FetchPaymentRequest(paymentID: "payment-123")
vipaso.payment.business.fetchPayment(request: request) { result in
switch result {
case .success(let response):
let payment = response.payment
// Display payment details
displayPaymentDetails(payment)
case .failure(let error):
print("Fetch payment failed: \(error.localizedDescription)")
}
}

Offline Payments

Sync Offline Payments

Upload offline payments stored locally to the server:

vipaso.payment.business.syncPayments { result in
switch result {
case .success:
print("Offline payments synchronized successfully")
case .failure(let error):
print("Sync failed: \(error.localizedDescription)")
}
}

Fetch Offline Payments

Get all offline payments stored locally:

let offlinePayments = vipaso.payment.business.fetchOfflinePayments()
print("Found \(offlinePayments.count) offline payments")

// Process offline payments
for payment in offlinePayments {
// Handle offline payment data
processOfflinePayment(payment)
}

Notes

  • BLE Payments: Payment requests are broadcast via Bluetooth to nearby customer devices
  • Payment States: Monitor payment status through the response objects
  • Offline Support: Payments can be processed offline and synchronized later
  • Cleanup: Always call stopBLE() when closing the app or switching contexts