Use cases
- Android
- iOS
Complete a payment in an Android shopping app
- Bank selection: Invoke
Volt.selectBank
- Create a payment request: Formulate the payment request
- Payment initiation: Call
Volt.payWithSelectedBank
Complete a payment in an e-commerce iOS app
- Bank selection: Implement
voltSdk.selectBank(customerId: [CUSTOMER_ID])
- Create a payment request: Build the request based on user’s cart.
- Payment initiation: Use
.voltPaymentSheet(token: $token)
as viewModifier.
Sample code (iOS only)
iOS payment integration
import SwiftUI
import VoltSDK
struct ExampleApp: View {
@State private var isPresentedSetBank = false
@State private var isBankSelected = false
@State private var token: String = ""
@State private var bankId: String = ""
@State private var amount: Int = 0
private var paymentManager = PaymentManager.shared
private var voltSdk = VoltSDK.shared
var body: some View {
VStack(spacing: 21.0) {
Button(isBankSelected ? "Change bank" : "Set bank") {
isPresentedSetBank.toggle()
}
Button("Start payment") {
Task {
await paymentManager.startPayment(bankId: bankId, amount: amount) { token in
self.token = token
}
}
}
}
.fullScreenCover(isPresented: $isPresentedSetBank) {
voltSdk.selectBank(customerId: "[CUSTOMER_ID]") { bankModel in
print("Bank list view ended")
bankId = bankModel.id
self.isBankSelected = true
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.voltPaymentSheet(token: $token)
.background(.white)
}
}
#Preview {
ExampleApp()
}
- On this page
- Use cases
- Sample code (iOS only)