2024

Oct

28

Av Rolf

There is an app in your iOS device called Wallet. In the Wallet app you can save different kind of coupons. You have probably used coupons in your Wallet app for flight boarding passes, event tickets, or your credit card for payments. We have made a Countdown Coupon! It counts down to a date, one day at a time. There is a corresponding app for Android, unfortunately for all Android users I will not write about it in this article.

A few years ago we did a project where we created event tickets in the iOS Wallet app. Since then, we have occasionally used the same technology ourselves to make our own coupons. And had a lot of fun! It's time to share some of the fun, at least so you can understand the possibilities.

We have tried different coupons and made discoveries one after the other. For example, did you know entire coupons can be updated at any time? In some cases coupons might be a better alternative than regular push notifications to get attention.

This isn't really a FileMaker specific solution, but using FileMaker makes everything much easier as usual. We often use FileMaker as a hub connecting other apps. This time I am using FileMaker to keep track of all coupons installed out there, update the coupon information, and regularly push updates to each installed coupon.

There is an upcoming FileMaker event in Malmö, Sweden (my home town since a few years), a developer conference called EngageU. Actually I can see the the top floors of the venue from my living room window.

The top floors of Malmö Live at night viewed from my living room. The conference will probably take place at the ground floor, but if you have the opportunity to visit the restaurant/bar at the top floor there is an amazing view over Malmö, the Öresund bridge, and surroundings. Don't forget to check out the view from the restroom in the corner!

 

I will attend the conference, hope you are coming as well!

If you plan to attend, go ahead and download our Countdown Coupon! It is (at the moment, October 2024) set to count down the days left to the FileMaker conference (our countdown clock can be set to something different in the future, keep the coupon!). And as a bonus you also get the current weather in Malmö! So far the autumn has been warm, sunny, and not so windy, but it can change fast.

The coupon layout is pre-determined. There are five different layouts for boarding passes, event tickets, store coupons for discounts, loyalty cards etc., and a generic layout. Some of them can have images, other not, some can have barcodes/QR, other not, etc.

I have used a layout for event tickets, without using the barcode/QR option. An event ticket layout can have either a backgound image (which will be blurred), or a strip at the upper half together with some text in fixed locations. I have chosen the strip alternative since I want to present something readable.

Our Countdown Coupon is updated a couple of times a day. When the Countdown Coupon is updated the current weather conditions is fetched from SMHI (yes, there is a json api), and a PNG image is created with the days left to the conference, todays date, a symbol for the weather, and the current temperature. The PNG is saved in the different fixed sizes needed using the GetThumbnail function in FileMaker, and uploaded to a web server using Insert from URL. When updated the background color changes randomly.

FileMaker then sends push notifications to every installed coupon. Well, the push notification is sent to an Apple server. Your Wallet app gets the push (from the Apple server) and responds by sending a request to a web service hosted by us, which produces a new and fresh countdown coupon. The new coupon is send back to your Wallet app in response. If there is a coupon in your Wallet app with the same id it will be replaced. This way you can change background color, text information, images, and all other settings of a coupon. It is like magic :)

An interesting feature is the ability to show a coupon on the lock screen. It can popup at a certain date/time, and/or at a certain place. You have probably seen this features when you board a flight, or get close to a football arena for a game. I can't promise anything, but if you download our Countdown Coupon it might popup some time.

What do you need to create you own coupon? First of all, you need to be an Apple Developer. Then you need a signing certificate which you get from Apple Developer Portal, where you also create a "pass type identifier". It is a name, ususally a reverse DNS string like "se.filemakerbloggen.passes.myfirst". I will not cover every detail of this process in this article. It should result in a certificate file (.p12), a password for the file, a pass type identifer, and your team identifer found in the Apple Developer Portal. A coupon also needs to have a serial number. The id of a coupon is the combination of serial number and pass type identifier.

To update an entire coupon you need to have web services. I wrote our web services in PHP and use FileMaker Data API to communicate with a FileMaker database published on a FileMaker Server. The coupon information is in FileMaker, but to make it easier (for me) I assemble the coupon in PHP, and also do the signing in PHP.

I have scheduled a script to run regularly on the FileMaker Server. It first fetches the current weather, and create the strip image. Then it loops through all the active coupons/passes and send a push notification to each one. The push notification triggers the request to another web services, which responds with a fresh coupon. Your Wallet app, and the coupon, must allow push notifications.

Download and install the Countdown Coupon on your iOS device here:

Skriv en kommentar

Din epost-adress stannar hos oss.
Webbsajten använder FileMaker som CMS.