Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.

Push Provisioning

Step 1: Showing the Add to Wallet button

When the end user first launches the issuer application, it must determine whether to show or hide the Add to Apple Wallet button for a specific card.

As early as possible, determine whether the end user has an iPhone or an iPhone paired with an Apple Watch.

Then combine this pairing status with the Push Provisioning SDK getToken API result to decide whether to show or hide the Add to Apple Wallet button.

import WatchConnectivity

class ViewController: UIViewController, TPCSDKProvisionDelegate, WCSessionDelegate {    
    // To store the isWatchPaired value before calling TPC function
    var isWatchPaired = false

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        if WCSession.isSupported() {
            let session = WCSession.default
            session.delegate = self
            session.activate()
        }
    }
    
    // MARK: WCSessionDelegate
    func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
        if error != nil {
            //handle error
        } else if activationState == .activated && session.isPaired {
            isWatchPaired = true
        }
    }
    
    func sessionDidBecomeInactive(_ session: WCSession) {
        // handle sessionDidBecomeInactive
        isWatchPaired = false
    }
    
    func sessionDidDeactivate(_ session: WCSession) {
        // handle sessionDidDeactivate
        isWatchPaired = false
    }
}

Then call the getToken API to update the result.

info-circle

Note

Refer to the PKAddPassButton guidelines for using the Add to Apple Wallet button in your issuer application.

The following applies to iOS SDK 2.0.0 and earlier.

The following applies to iOS SDK 2.1.0 and later.

exclamation-circle

Caution

  • If the card still appears as "NOT_DIGITIZED" after provisioning, verify that the issuer application is configured correctly in the TSP portal.

  • The TPCSDK.isCardDigitized API is deprecated and not recommended. Use the getToken API instead. The isCardDigitized API does not indicate whether the card is pending activation or whether it is on an iPhone or Apple Watch.

Step 2: Provision a card

The provisioning delegate returns a PKPass after provisioning completes. Use it to check the card digitization status. If the delegate returns nil, the SDK also returns an error.

Before using the PKPass class, make sure to add the PassKit.framework to your project.

exclamation-circle

Warning

You must add the Push Provisioning entitlement to the issuer application before calling this API. Otherwise, the API returns an error. To get the entitlement, follow the Push Provisioning Access guidelines.

info-circle

Use the getToken API to obtain localPKPass or remotePKPass. If either localPKPass or remotePKPass is not nil, access the primaryAccountIdentifier property of the PKSecureElementPass object. Pass the retrieved primaryAccountIdentifier to the provision API.

Provisioning with standard scheme enum values for Visa, Mastercard, Amex, and Discover

Provisioning with a scheme string (standard)

Last updated

Was this helpful?