Skip to main content
Version: Next

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 a nearby payment request

Send a payment request via BLE to all potential payers in range. The method returns when the first payer successfully accepts the payment and pays.

vipaso.payment.business.sendNearbyPaymentRequest(
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)")
}
}

BLE Contactless Payment (Send)

Contactless Payment allows sending a payment request via BLE to a specific customer device identified by a tag ID. This is a targeted, one-to-one BLE payment session.

Send a contactless payment request

Send a payment request via BLE to a specific merchant terminal identified by its tag ID. The method returns the result when the payer accepts or the operation completes.


guard let tagID = UUID(uuidString: "terminal-tag-uuid").uuidString else {
throw YourError.ForInvalidTagID
}

vipaso.payment.business.sendContactlessPaymentRequest(
amount: "25.00",
currency: "USD",,
paymentReference: "order-123" // Optional,
tagID: tagUUID
) { 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)")
}
}

The result of both of these calls is either a VipasoBusinessPaymentResponse object on success or a VipasoError: Error in case of a failure.

Cancel Payment

Cancel an ongoing 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