Add Siri Payments to Your Finance Application

Topics
Voice-plus
Author
Alessio Roberto
Publication Date
24 July 2020

Add Siri Payments to Your Finance Application

During the fall of 2016, Apple released a new Siri capability: payments.

This functionality works in the same way that Alexa intents work, and it must not be confused with Siri Shortcuts. In this short article, we will provide the steps that you need to take so that your customers can use their voice to launch, use, and interact with your financial application.

First of all, what is the difference between Siri Shortcuts and Siri Payment?

Siri Shortcuts require the developers to think about and create the intents that the customer will say so that Siri can recognize them. With Siri Payments, developers need to consider requests about money (send and request payment, pay a friend, etc.) and show the users which application supports these functionalities. Then the users, using only their voices, can start the dialogue with Siri and use the app (s)he chooses.

To better explain, here is a real-life example:

If you are an ING, bunq, or Monzo user (to mention some of the digital banks that support it), you can ask Siri to transfer a certain amount of money to a person that uses the same bank. After that, Siri will guide you throughout the short process to finalize the payment which includes biometric security checks.

Siri 1Siri 2


At this moment, with iOS 13, Siri can handle four payment flows:

  • Pay Bill
  • Request Payment
  • Send Payment
  • Money Transfer

After this short introduction, you can see how easy it is to implement Siri “Send Payment” with your bank/finance applications.

Here are the steps:

Intent Definition

First, you need to add a SiriKit Intent Definition file:

  • ⌘N to add a new file to your project
  • Chose iOS for the template
  • Search for SiriKit
  • Select the SiriKit template and press Next
  • Name the original file and save it

Then, select the file from the project navigator and add the Customize Intent you need. In our case, we selected “Send Payment.”

Siri 3

Compared with Siri Custom Intents, you will have a prefilled configuration.

Siri 4

The next step is to write the code that will handle user requests (in this example, “Send Money to Someone”).

Implementation

Application Extension

Just like with Siri Shortcuts, you need to add an Intents Extension.

Siri 5

Intents Handler

With the extension creation, Xcode add a new class to your project:

`final class IntentHandler: INExtension, INSendPaymentIntentHandling`

In this class, we will create all the logic to interact with the user’s requests made with Siri. Every time Siri recognizes a voice request related to “Send Money to Someone,” it will first ask which application the user wants to handle the request. If the user choose your application, all the dialogue between Siri and the user go through INSendPaymentIntentHandling delegates:

Siri 6

The basic flow is:

  1. Check if the user asked to use the correct currency for the transfer.
  2. Ask to confirm the transfer. For example, if the transfer recipient is not present in the internal list of known users or the amount is not allowed for this type of transfer.
  3. Execute the transfer and manage any failure use cases.
  4. Communicate to the user if the transfer was successful.

Never forget to use LocalAuthentication framework to authenticate the user with FaceID/TouchID before the transfer.

In the following demo code snippets, I show a basic implementation, without real interaction with a backend and with “no happy scenarios” not handled properly.

Siri 7

Check the transfer request currency and if it’s not correct, ask the user to confirm the change.

Siri 8

Check if the amount is above the maximum allowed (or minimum) and if the user has money in the account.

Siri 9

Finally, remove the amount from the user’s account and process the transfer.

Conclusion

After this first glance, we hope you see how easy it is to add Siri Payment to an existing application. Siri doesn’t have access to any personal information and doesn't have control of the application logic, so there is no reason not to implement it!

Let our expertise complement yours

Leave your details below and we'll be in touch soon.