How to get a response after integrating UPI using a hyperlink

In my iOS application, I need to accept payments from the user. I use UPI for the same. I have completed the following document provided by UPI

http://www.npci.org.in/documents/UPI-Linking-Specs-ver-1.1_draft.pdf

I created deeplink as indicated in the document. UIApplication.shared.openused to open the deeplink url so that it opens any installed PSP application (payment service provider) on my phone (e.g. PhonePe, BHIM, etc.)

func payButtonClicked() {

        guard let urlString = "upi://pay?pa=samplevpa@ybl&pn=Sample Name&am=1&cu=INR".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
            else {
                return
            }

        guard let url = URL(string: urlString) else {
            return
        }

        if !UIApplication.shared.canOpenURL(url) {
            print("url cannot be opened")
            return
        }

        UIApplication.shared.open(url, options: [:], completionHandler: { (success) in

            print(success)

        })

    }

I registered my application with custom URL schemes and added the upi scheme for ApplicationQueriesScheme in the plist file

<array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>SampleApp</string>
            </array>
            <key>CFBundleURLName</key>
            <string>com.company.SampleApp</string>
        </dict>
    </array>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>upi</string>
    </array>

PSP, . , PSP. UIApplication.shared.open . PSP .

+9
1

, url, .

URL , , , , , .. , mp3 .. .

URL URL, , , .

, , , , , .

https://www.npci.org.in/sites/all/themes/npcl/images/PDF/UPI_Linking_Specs_ver_1.5.1.pdf

0

All Articles