Use cases

  • Android
  • iOS

Complete a payment in an Android shopping app

  1. Bank selection: Invoke Volt.selectBank
  2. Create a payment request: Formulate the payment request
  3. Payment initiation: Call Volt.payWithSelectedBank

Complete a payment in an e-commerce iOS app

  1. Bank selection: Implement voltSdk.selectBank(customerId: [CUSTOMER_ID])
  2. Create a payment request: Build the request based on user’s cart.
  3. 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()
}