Group Group Group Group Group Group Group Group Group

Unable to get INSendPaymentIntent work with SiriKit on watchOS (3.2 and 4)

#1

I finished SiriKit Payment Intent app.
Now I am working on watchOS sirikit payment app (as a companion app for the iPhone app obviously). The same framework, logic for intent and handler are working on iOS. But I have problem with watchOS app.

I developed the intent and handler. When I ask Siri
Using CoolPay send Albert $40

Siri replies…
Sorry I can't do that., and gives a button Open CoolPay

I saw some posts saying Payment Intent for Siri is not available on watchOS. But I see the intent is available on watchOS. Please give pointers.

@available(watchOS 3.2, *)  
open class INSendPaymentIntent : INIntent {  
    public init(payee: INPerson?, currencyAmount: INCurrencyAmount?, note: String?)  
    @NSCopying open var payee: INPerson? { get }  
    @NSCopying open var currencyAmount: INCurrencyAmount? { get }  
    open var note: String? { get }  
}  

The Plists and projects have right permissions and capabilities. Payment Intent Plist has the below keys.

Image Link for Plist Keys for Payment Intent

// WatchIntentsExtension.swift
import Intents
import PaymentsFrameworkWatchOS

class WatchIntentsExtension: INExtension {
    let paymentProvider = PaymentProvider()
    let contactLookup = ContactLookup()

    override func handler(for intent: INIntent) -> Any? {
        print("Watch Overriding")
        guard intent is INSendPaymentIntent else { fatalError("Unhandled intent type \(intent)") }

        return WatchSendPaymentIntentHandler(paymentProvider: paymentProvider, contactLookup: contactLookup)
    }
}

I cannot post code for Handler as I have compliance issues. What I can tell is… the same framework and the same call backs works for iPhone Siri though.

#2

Hi @polepeddi and welcome to the forums :slightly_smiling_face:.

I haven’t tried integrating with SiriKit on watchOS myself yet and i’m not able to answer the question directly but I know how frustrating watchOS development is on it’s own because of how little support there is available on the web and how painful it is to debug.

I ran into a similar situation before and i’d recommend doing a couple of things:

  • Scan the system logs of the watch as you try to invoke the intent as there might be some helpful info out there.
  • Get onto this thread, it’s had a reply from somebody at Apple and they’re probably your best bet at getting an answer.
  • Maybe try eliminating any unrelated code and trying the most basic example in a fresh and empty project because it could be the most simple of changes that is having an impact.

I hope the above helps and please give me a shout if you have any other questions. Good luck! :+1:

#3

Hi, it was me who posted the question in the Apple Dev Forum.