使用超链接集成UPI后如何获得响应 [英] How to get response after integrating UPI using hyperlink

查看:304
本文介绍了使用超链接集成UPI后如何获得响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iOS应用程序中,我需要接受用户付款.我同样使用UPI.我遵循了UPI提供的以下文档

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

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

我已经按照文档中所述创建了一个深层链接. UIApplication.shared.open用于打开深度链接网址,以便打开我手机中所有已安装的PSP(付款服务提供商)应用程序(如PhonePe,BHIM等)

I have created a deeplink as stated in the document. UIApplication.shared.open is used to open the deeplink url so that it opens any installed PSP(Payment Service Provider) application in my phone(like 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)

        })

    }

我已经用自定义URL方案注册了我的应用程序,并在plist文件中为ApplicationQueriesScheme添加了方案upi

I have registered my application with custom URL schemes and have added the scheme upi for ApplicationQueriesScheme in 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应用程序中获取事务的状态,并将状态显示给用户.任何帮助表示赞赏

It is opening the PSP application and I'm able to make the transaction. The problem is I'm not able to get the response back from the PSP application. There is no callback method to UIApplication.shared.open method. I need to get the status of the transaction back from the PSP application and show the status to the user. Any help appreciated

推荐答案

您可以使用url参数,以带有订单ID或付款ID为参数的get方法传递您的网站url.付款成功后,UPI提供商必须命中URL. 该URL的目的应该是不断更新交易状态,然后触发最终用户一封带有交易状态的电子邮件或SMS.

You can use the url parameter to pass your website url with the get method with order id or payment id as parameter. Once the payment is successful, it is mandate the UPI provider to hit the URL. The purpose of the URL should be keep updating the transaction status and trigger then end user an email or SMS with the transaction status.

这篇关于使用超链接集成UPI后如何获得响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆