Live demo of agent247 on Digio's docs — click the orange button at the bottom right to start.

iOS UPI SDK

GitHub release (with filter) Cocoapods Version License Logo

Overview

This guide provides step-by-step instructions on how to integrate the Digio UPI SDK into your iOS application. The Digio UPI SDK enables seamless integration of Unified Payments Interface (UPI) functionality into your app, allowing corporate/users to register MANDATE and Reverse Penny Drop for account verfication.

Note: The Digio SDK supports iOS version 13.0 and above.

Getting Started

Step 1: Digio upi is available through CocoaPods. To install it, add the following line to your Podfile

pod 'DigioUpi'

Step 2: Run

pod install

Step 3: Import Digio UPI Module

import DigioUpi

Step 4: Initiate digio Builder and pass required data.

func startDigio()  {
        do {
            let digio = try DigioUPI.Builder()
                .setEnvironment(environment: .PRODUCTION)
                .setId(id: "nachId/kycId")
                .clientKeys(clientId: "Your_clientId", clientSecret: "Your_clientSecret")
                .setServiceType(serviceType: .MANDATE)
                .build()
            digio.startDigio()
        }catch {
            print("digio_exception \(error.localizedDescription)")
        }
    }

Step 5: Initialize DigioCallback in your view to observe response and events

  • SwiftUI Define below in your View
@ObservedObject var digioCallback = DigioCallback.shared
  • Swift Define below global varialable in your ViewController
private var transactionObserver: Any?
private var transactionEventsObserver: Any?

Step 6: Register DigioCallback to observe SUCCESS/FAILURE/Events response.

  • SwiftUI Implement observer inside body of view to get response from framework
     func observeDigioCallBack(){
        if let transactionStatus = digioCallback.transaction{
            switch transactionStatus {
            case .success(let response):
                let _ = print("digio_success --> \(response.description)")

            case .failure(let response):
                let _ = print("digio_failure -->\(response.description)")

            case .partial(let response):
                let _ = print("\(response.description)")

            }
        }

        /** Optional : To observe user journey for analytics purpose  **/
        if let event = digioCallback.transactionEvents{
            switch event {
            case .onTransactionEvent(let events):
                let _ = print("digio_event --> \(events.description)")
            }
        }
    }

  • Swift Implement observer inside viewDidLoad to get response from framework
func observeDigioCallBack()  {
        let digioCallback = DigioCallback.shared
        transactionObserver = digioCallback.$transaction.sink { [weak self] transaction in
            switch transaction{
            case .success(let response):
                print("digio_success--> \(response.description)")
            case .failure(let response):
                print("digio_failure--> \(response.description)")
            case .partial(let response):
                print("digio_partial--> \(response.description)")
            case .none:
                break
            }
        }
         /** Optional : To observe user journey for analytics purpose  **/
        transactionEventsObserver = digioCallback.$transactionEvents.sink { [weak self] transactionEvents in
            switch transactionEvents{
            case .onTransactionEvent(let events):
                print("digio_event --> \(events.description)")
            case .none:
                break
            }

        }
    }

Clear observer from ViewController by calling below in ViewController oustside of viewDidLoad function. This apply only for swift.

deinit {
        // Release memory when the view controller is deallocated
        transactionObserver = nil
        transactionEventsObserver = nil
    }

Step 7: Add LSApplicationQueriesSchemes in your iOS app's Info.plist file

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>phonepe</string>
        <string>gpay</string>
        <string>paytmmp</string>
        <string>bhim</string>
        <string>upi</string>
        <string>ppe</string>
    </array>

Parameter and type

ParameterTypeDescription
clientId clientSecretstringMandatory Your clientId and clientSecret key
setIdstring Mandatory Your Nach Id for Mandate or KYC ID for Reverse penny drop
PRODUCTION SANDBOXDigioEnvironmentMandatory Environment can be SANDBOX or PRODUCTION
MANDATE REVERSE_PENNY_DROPDigioServiceMandatory DigioService can be MANDATE or REVERSE_PENNY_DROP

Error code and Description

CodeDescription
1103SUCCESS
1104FAILURE
1105CANCELLED
1108PARTIAL
1106UPI APP NOT FOUND

Response sample

StatusResponse
EVENTSDigioUPIEvents(action = DIGIO_INITIATED, screen = UPI_PAGE)
SUCCESSDigioUpiResponse(id= ENA23101017504882619RVM5Y1DTYPEUP, message= Mandate REGISTER_SUCCESS, statusCode= 1103, status= register_success, crash_report= null )
FAILUREDigioUpiResponse(id= ENA23101017504882619RVM5Y1DTYPEUP, message= Transaction cancelled, statusCode= 1105, status= partial, crash_report= null )
PARTIALDigioUpiResponse(id= ENA231012193700713FA5VYQRZT6916UP, message= Mandate created partial, statusCode= 1108, status= partial, crash_report= null )

Support

For support, Contact Support

Was this page helpful?