Rohith Singh
Rohith Singh

Reputation: 75

How to integrate Google Pay in iOS swift?

Hi Friends i have searched about google pay integration in iOS swift. I didn't t find any relevant solution. please help me how to work on this, if any links or examples please provide link and guide me

Thank you

Upvotes: 2

Views: 6861

Answers (4)

Davender Verma
Davender Verma

Reputation: 573

@IBAction func action_proceedBtnTapped(_ sender: UIButton) {

    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)
}

Upvotes: 3

Soc
Soc

Reputation: 7780

Is this a question about initiating a Google Pay action in India? Example, with UPI?

If so, you can try launching it with the following UPI URI scheme:

upi://pay?parm-name=param-value&param-name=pram-value&...

That should launch whatever app is configured to handle UPI.

If you want to launch the Google Pay app in India directly, you could try the following instead:

gpay://upi/pay?parm-name=param-value&param-name=pram-value&...

Upvotes: 4

Mikita Haurylovoch
Mikita Haurylovoch

Reputation: 59

At the moment there is no way to integrate Google Pay in your iOS app. At least for native iOS app i suggest to use Apple Pay

More info here

Upvotes: 2

Rithik Banerjee
Rithik Banerjee

Reputation: 467

Google Pay is only available for JavaScript v3 SDK and Android v2 SDK. Learn more here: https://developers.braintreepayments.com/guides/google-pay/client-side/ios/v4

Upvotes: 2

Related Questions