How to get Google Pay response after returning back to app in iOS

938 views Asked by At

I'm trying to make a transaction through Google Pay app. I've implemented this so far:

let paValue = "Client_upi_key"  //payee address upi id
let pnValue = "Merchant Name"     // payee name
let trValue = "1234ABCD"        //tansaction Id
let urlValue = "http://url/of/the/order/in/your/website" //url for refernec
let mcValue = "1234"  // retailer category code :- user id
let tnValue = "Purchase in Merchant" //transction Note
let amValue = "1"  //amount to pay
let cuValue = "INR"    //currency

let str =  "gpay://upi/pay?pa=\(paValue)&pn=\(pnValue)&tr=\(trValue)&mc=\(mcValue)&tn=\(tnValue)&am=\(amValue)&cu=\(cuValue)"

 guard let urlString = str.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
 else {
     return
 }

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

 UIApplication.shared.open(url)

Now I'm returning to my app & want to have some response like transactionID, userID etc from Google Pay. Is there any way like Android to use Intent in this scenario?

1

There are 1 answers

3
Sam MacGinty On

As far as I can see the Google Pay API is only available on Android and Web. Judging from the current docs only showing those options.

If you are looking for a simple payments API, Stripe I know is quite easy to implement. You could also try the Apple Pay SDK.