How to Add a Credit/Debit Card into Apple Wallet from the iOS App

How to add a credit/debit card into apple wallet from the ios App

The good news is that this can be done. What you are looking for is In-App Provisioning of Payment Cards. This is done using the PKAddPaymentPassViewController, which requires the com.apple.developer.payment-pass-provisioning entitlement key for your app. The bad news is that not anyone can submit apps with this entitlement as it requires special permission from Apple, which I believe is reserved for card issuers like banks and similar. If you believe that you qualify you need to contact Apple directly at apple-pay-inquiries@apple.com.

How to make an app available in Apple's Add to Wallet screen?

Yes, this is enabled when you setup a "Non UI Extension" in your project. The app extension needs to be able to call your backend and do the provisioning flow just like in-app.

https://developer.apple.com/documentation/passkit/pkissuerprovisioningextensionhandler

There is documentation from Apple for this called:
Apple Pay In-App Provisioning Extensions for Payment Cards

Add a bank card to Apple Wallet

I know that me need to get permission from Apple for this

&

I understand that this object will nill until Apple allows to add
cards to Apple Wallet?

Yes, you're correct.

Adding payment passes requires a special entitlement issued by Apple.
Your app must include this entitlement before this class can be
instantiated. For more information on requesting this entitlement, see
the Card Issuers section at https://developer.apple.com/apple-pay/.

Add a card to Apple Wallet

Seems that it is completely impossible.

According to In-App Provisioning Getting Started Guide:

XII. Testing Prior to Release on the App Store

Testing will occur through the use of the production environments. The iOS app will be distributed for testing purposes via the production App Store after the necessary approvals. A few points to note:

  • The issuer must also provide the Adam ID, the numeric Apple ID of the application, to apple-pay-provisioning@apple.com prior to testing. 


  • The distribution of the app for testing purposes must be through the use of Promo Codes. Please look here for more information on the use of Promo Codes for limiting the distribution of an app via the App Store. 


  • Be sure to select “Manual Release” when submitting your app for App
    Review, otherwise you may inadvertently release the test app to the
    general public.

  • Once testing is complete, the app can be made available for public
    download by selecting “Release This Version” within iTunes Connect.
    In case changes have been made to the app after inclusion on the App
    Store for testing, you will need to “Cancel This Release” within
    iTunes Connect. You can then re-submit your corrected app to the App
    Store for approval. Please click here for additional information on
    this part of the process.

    Please note that Test Flight can not currently be used to distribute apps for In-App Provisioning testing.

Programmatically add a credit/bank card to a user's apple wallet

You can add a credit card into apple wallet by creating .pkpass on the server-side

and download that file on the ios side it will add to the ios wallet

Here is the code to download the .pkpass (passbook file) from server with completion handler and show pkpassviewcontroller for further adding into the apple wallet.

  import PassKit

let url : NSURL! = NSURL(string: "YOUR .pkpass URL GOES HERE")
let request: NSURLRequest = NSURLRequest(url:
url as URL)
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)

let task : URLSessionDataTask = session.dataTask(with: request as URLRequest, completionHandler: {(data, response, error) in

var error: NSError?
let pass = try? PKPass(data: data!, error: &error)
if error != nil {
DispatchQueue.main.async {
let alertView = UIAlertView(title: "Error", message: (error?.localizedDescription)!, delegate: nil, cancelButtonTitle: "OK", otherButtonTitles: "Cancel")
alertView.show()
}
}
else {
let passLibrary = PKPassLibrary()
if passLibrary.containsPass(pass!) {
DispatchQueue.main.async {
let alertView = UIAlertView(title: "Already Exist", message: "This pass already added in wallet. Thanks!", delegate: nil, cancelButtonTitle: "OK", otherButtonTitles: "Cancel")
alertView.show()
self.hideLoading()
}
} else {
let pkvc = PKAddPassesViewController(pass: pass!)
pkvc.delegate = self
self.present(pkvc, animated: true, completion: {() -> Void in
// Do any cleanup here
self.hideLoading()
})

}
}

})
task.resume()

PHP library to create passes for iOS wallet app

https://github.com/flexible-agency/php-pkpass



Related Topics



Leave a reply



Submit