1

i have already created static version of coupon in apple device. now im want to update my new values directly on my coupon card, when value update in my database via API call.

i know this is possible just like boarding pass when seat number change it directly change on e-boarding pass.

please guys if you can provide good example links how to call API and how to fetches values from API and update coupon, it will be great help.

Note: My API will not be in objective-C.

Thanks

M.A
  • 448
  • 6
  • 21
  • This isn't the place to ask for copy/paste solutions. There are 3 main components you will need to build - a RESTful web service that implements the specification published by Apple; a database to hold device tokens and dynamic pass data; and a push server that implements the APNS protocols. There is pleanty of documentation available and Apple also publish a sample server written in Ruby with an SQLite database. – PassKit Apr 20 '17 at 15:11
  • thanks for your quick reply. i was not asking copy/paste solution if you could please share the good documentation links it will be great help. im kind of beginner. thanks again ... – M.A Apr 20 '17 at 15:20
  • 2
    https://developer.apple.com/wallet has everything you need. – PassKit Apr 21 '17 at 05:03

2 Answers2

4

You need to implement Apple pass creation, distribution and updation code in your backend solution. Find the following references and documentations:

Apple Pass for JAVA backend :

https://github.com/drallgood/jpasskit
https://dzone.com/articles/ios-and-android-push
http://www.ryantenney.com/passkit4j/

Apple Pass Web URL specs:

https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html

Apple Pass for PHP backend :

https://github.com/tschoffelen/PHP-PKPass

Apple Pass with Ruby

https://oleb.net/blog/2013/02/passbook-tutorial/

APNS with Node.js :

https://solarianprogrammer.com/2017/02/14/ios-remote-push-notifications-nodejs-backend/

Push notification for updating iOS Pass :

https://stackoverflow.com/questions/15877496/how-to-make-a-push-notification-for-a-pass

Pass Kit Web Service Reference: https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html

Important Note : If you are using any JAVA JAR, please check which server OS you are using, like IBM AIX OS (uses IBMX509) or Oracle OS (used SUNX509). Many libraries of Apple pass in JAVA is available which only support SUN JDK. You can land up into huge trouble in the last moment, if your server is AIX OS and JAR is using SUN. For Eg: jPassKit JAR from https://github.com/drallgood/jpasskit only supports SUN JDK, so you can't use this for IBM AIX OS server.

Vineet Ravi
  • 1,457
  • 2
  • 12
  • 26
  • thanks for response you know any php library/ web services to automatically update content on the pass, such as gate changes on a boarding pass, or adding credit to a loyalty card. – M.A Jun 16 '17 at 18:49
  • The link is provided above for PHP backend which handles Pass creation, distribution and updation in your case. Using the library above first you need to create a pass and provide a link to download it. While you create that pass, there is a key named "webserviceurl" in pass.json, which will be called to update the pass when you send an empty push notification to the devcie from the above mentioned library. – Vineet Ravi Jun 18 '17 at 07:10
  • Yes I'm able to generate my pass that part is done and working I'm but stuck in backend part any good library which implemented in php or java ? which is easy to implement what I want whenever pass install in client device I webservice store push token in db and I can push new changes to client card from that push token. – M.A Jun 18 '17 at 07:15
  • I have mostly integrated Pass on JAVA backend but you can try this... https://github.com/tschoffelen/PHP-PKPass – Vineet Ravi Jun 18 '17 at 07:18
  • Great let me try this I'll update u... java I was looking jpasskit library look like it required full implementation right.. – M.A Jun 18 '17 at 07:25
  • jpasskit jar : https://mvnrepository.com/artifact/de.brendamour/jpasskit – Vineet Ravi Jun 18 '17 at 07:30
  • jpasskit sample code : http://www.programcreek.com/java-api-examples/index.php?api=de.brendamour.jpasskit.PKPass – Vineet Ravi Jun 18 '17 at 07:30
  • thank you so much @vineet do you know any basic implementation guide? i tried earlier but i was i did not get any success – M.A Jun 20 '17 at 14:00
  • There are no basic implementation guides which can guide you to start from scratch.. Believe me I tried.. However what I did was to find all possible JARs for APNS and Passkit (since my backend code is in JAVA), and give it to my JAVA developer to integrate into my WebLogic server having JDK 1.8. I used jPassKit jar as I mentioned above and everything worked fine.. – Vineet Ravi Jun 23 '17 at 04:44
  • Thanks @vineet how do you guys push new update just u update content it automatic notify user ? – M.A Jun 23 '17 at 04:48
  • When you want to update a pass, all you have to do is to put %@ in change message parameter and send an empty push notification with payload E.g. {"aps":""}. – Vineet Ravi Jun 23 '17 at 05:02
  • For more info. refer this link and follow the comments on the same: https://stackoverflow.com/questions/15877496/how-to-make-a-push-notification-for-a-pass – Vineet Ravi Jun 23 '17 at 05:02
  • Thanks @VineetRavi one last question how did u generate .pem. Certificate ? Mine when ever I'm trying to send push notifications it give me time out in connection it means my certificate it bed ? – M.A Jun 23 '17 at 05:05
  • You would need two certificates.. One is the .p12 file and other is appleWWDRCA file. You can get the second file from Keychain->Select **Certificate** and **Login** options from left side menu->Select **Apple Worldwide Developer Relations Certification Authority**, right click and export as .pem. – Vineet Ravi Jun 23 '17 at 05:15
  • thank you soo much @Vineet this is valuable information right now im having certificate issue let me try again i'll update you... – M.A Jun 23 '17 at 13:21
  • hi @Vineet i have a one more question.. does pass update rate is 100%? when i try to update more then one time some time it work some time it doesn't is it normal behavior? – M.A Oct 07 '17 at 01:14
4

I wrote an article about how to write the web services for apple wallet here: https://medium.com/@yangzhoupostbox/asp-net-web-api-example-for-apple-wallet-passbook-a124a1d90bb3

yzhou5
  • 123
  • 1
  • 9