iOS how to take user directly to the Wallet app
Asked Answered
R

2

6

I'm integrating Apple Pay now and I see iOS Human Interface Guidelines for Apple Pay.

https://developer.apple.com/design/human-interface-guidelines/apple-pay/

Set up Apple Pay Button

How can I open the Wallet app when the user taps a button?

Ribonuclease answered 3/11, 2016 at 9:8 Comment(5)
Hii Soft Dev . Did you find solution for this completely? I have the same issue.when ever user clicks the add cards to wallet then it directly to the wallet app for add the cards. please suggest me.Vardon
@Vardon Did you check the below answer?Ribonuclease
For that, any special entitlements are needed from Apple. com.apple.developer.payment-pass-provisioning is this needed.Vardon
@Vardon This post is for asking the way to open wallet app. And the answer I accepted works well.Ribonuclease
okk. Thank you. i got itVardon
C
12

Check out the PKPaymentButton. There are already pre-built buttons for this as part of PassKit.

let setupButton = PKPaymentButton(type: .setUp, style: .black)

More information can be found at the PKPaymentButton Reference.

EDIT:

PKPassLibrary can actually perform the action. You can use it like so:

let library = PKPassLibrary()
library.openPaymentSetup()

More information can be found here.

Note: The above call will only work on a real iOS device.

Cock answered 3/11, 2016 at 13:48 Comment(6)
it just supports UI only, doesn't it?Ribonuclease
Ah yes, you're right. I'll update my answer momentarily.Cock
Hmm, I don't see why it wouldn't. I will verify tonight.Cock
Thanks! I will be waiting your reply.Ribonuclease
Confirmed, this will not trigger anything on the simulator, and will work on a real iOS device.Cock
Hii Mark .let library = PKPassLibrary() library.openPaymentSetup(). is this libary display the apple wallet when user taps the add cards to wallet button.Vardon
A
1

Code in Objective C, same as @Mark answer:

First you have to import PassKit:

@import PassKit;

And call func to open Wallet App, func:

-(void) openAppleWalletApp {
    PKPassLibrary * wallet = [[PKPassLibrary alloc] init];
    [wallet openPaymentSetup];
    
}
Arianna answered 18/3, 2021 at 12:21 Comment(1)
Thanks so much, nice to see Objective-C is still alive, I love coding in it. Presumably Apple will eventually only support Swift?Trudytrue

© 2022 - 2024 — McMap. All rights reserved.