Overview


This product is currently in its beta release and is available to integrate to on request. Please contact our integrations team about getting access https://www.windcave.com/contact-us.

The Windcave Tap to Pay SDK allows merchants to integrate Tap to Pay on iPhone functionality into their iOS application to accept contactless payments without the requirement for any additional payment terminal or hardware.

In addition to encapsulating the Proximity Reader API the Tap to Pay SDK handles calls to the Windcave REST API ensuring all the complex items of processing are handled.

This guide will help you get started with your Tap to Pay SDK implementation, please refer to the Windcave Tap to Pay SDK for reference with detailed functions and message explanations.

Prerequisites


Prior to implementing the Tap to Pay on iPhone SDK merchants must first ensure the meet the below prerequisites:

The Tap to Pay on iPhone SDK supports iOS version 17+ and available in the below region(s):

  • Australia
  • New Zealand

Merchants must have an active Windcave account and REST API user with Tap to Pay on iPhone functionality enabled.

Implementing Tap to Pay on iPhone


Installing the SDK

Recommended installation instructions can be found on the Windcave Tap to Pay SDK for iOS Github page.

Preparing the Application

While the SDK removes some of the transaction processing complexities, it must still be setup and configured according to Tap to Pay on iPhone requirements. This includes:

  • Requesting the Tap to Pay on iPhone entitlement
  • Adding the Tap to Pay on iPhone entitlement to the application

For details on these requirements please refer to the Tap to Pay on iPhone developer documentation.

Preparing the SDK

The entry point to the SDK functionality is the class WindcaveTapToPay, it provides all the necessary functionality to perform Tap to Pay transactions.

In order to provide the smoothest possible experience and avoid unnecessary wait times, Apple recommends preparing the iOS card reader as soon as possible when the app starts or returns to the foreground. This ensures everything is ready once the application is ready to start the transaction.

As such below are few recommendations:

  • Always attempt to create and maintain the instance of WindcaveTapToPay throughout the application lifetime. Constructing the WindcaveTapToPay instance triggers the first stage of the card reader initialization, therefore the sooner it is done the better.
  • Call the isAvailable() method of WindcaveTapToPay to check if Tap to Pay on iPhone is available to the current device.
  • When practically feasible, call the prepare() method of the WindcaveTapToPay instance to get the card reader fully prepared. Please note calling this method might bring a Tap to Pay UI (further details below).

Important note from Apple: For security, the reader session is invalidated when an app using Tap to Pay on iPhone moves to the background. Call prepare() as soon as the app is brought to the foreground to allow the user to use the terminal without having to wait for the reader to finish preparing.

It is safe for applications to call prepare() multiple times throughout the application lifetime. The SDK will automatically check the status of the reader and only perform necessary actions if it is needed. The application must also call prepare() after each transaction to reset the internal state of the SDK to prepare it for the next transaction.

WindcaveTapToPay Object

The WindcaveTapToPay object encapsulates the ProximityReader API calls as well as handling communications with the Windcave REST API for transaction processing.

Before using the SDK the application developer must make a decision on the below items:

  • How will the SDK communicate with the Windcave server?
  • Will the SDK provide its own UI?
  • How will the SDK logging be handled?
  • How will the SDK data be persisted?

For further information on these items please refer to the WindcaveTapToPay reference guide.

Starting the Transaction

Once the instance of WindcaveTapToPay object has been constructed and the reader is prepared, the application should call the doTransaction method of WindcaveTapToPay:

The below values should also be provided to the doTransaction method from the application developer:


Value Description
reference This is the merchant reference for the transaction. The value is recorded with the transaction at Windcave and can be used by merchants to correlate the transaction with a order/payment.
txnType Specifies the type of transaction to be initiated, possible values are:

  • purchase
  • auth
  • validate
  • refund
amount The amount to be charged for the transaction.

Please note if the application is attempting to trigger a validate transaction, the amount can be set to "0.00".

notificationUrl Optional webhook URL to pass to the Windcave server. If populated the Windcave server will trigger a FPRN request to this URL.
customerEmail Optional customer email address to pass to the Windcave server. If populated the Windcave server will trigger an email receipt to the provided email address provided once transaction is finished.
resultCallback The callback that will be triggered once the transaction processing has finished.

Checking the SDK State

The SDK maintains its own internal state that can be inspected. It is available as a status property of the WindcaveTapToPay instance. The SDK state is wrapped into CurrentValueSubject object, which allows the application to subscribe to the SDK state change and act accordingly.

The status subject value is provided in a form of an instance of TapToPayStatus which in turn provides:


Field Description
status The enumeration indicating the current status.
statusText The optional text information about the status.
transactionResponse An instance of WindcaveResponse for just finished transaction. This value will only be provided when the status is transactionFinished.


For more information and a full list of possible status values please refer to the SDK reference guide.

Once the transaction is finished, the SDK will be in the transactionFinished state where the application can access the status.transactionResponse and act accordingly. Once the transaction result has been processed by the application it must call prepare() to return the SDK back into the readyToUse state before attempting to start a new transaction. Attempting to call doTransaction while the SDK is still in transactionFinished state will throw a TapToPayError.notReady error.

Outstanding Transaction

While this should not occur often, it is possible that the application will be terminated while the transaction is still being processed (whether due to hardware issue, network issue or an application crash).

In this scenario the application must have recovery measures in place, the SDK can assist with this by providing a few methods:

Please note these methods only help with cases where the Windcave server wasn't able to return the transaction result in a timely fashion and the application was terminated during the transaction status polling phase.



Method Description
hasOutstandingTransaction This method returns true if the SDK is aware of the transaction that has not been finished properly.
restoreTransaction This method restarts the Windcave transaction querying to get the transaction result, it will then trigger a callback and return a response once the final response has been received.
getOutstandingTransactionId Returns Windcave Transaction ID of the outstanding transaction, in case the application developer would like to manually handle the recovery.
clearOutstandingTransaction Clears the ID of the outstanding transaction.

Accepting Tap to Pay on iPhone Terms and Conditions

Prior to using Tap to Pay on iPhone functionality merchants must first accept the Tap to Pay on iPhone terms and conditions. There are two ways this can be done:

  • Review and accept T&Cs via Payline. To do this the merchant must log into Payline using their API username, navigate to My User and press the button "Review and Accept T&Cs". This will bring up Apple's business portal where the merchant can log in and accept the T&Cs.
  • Review and accept T&Cs via the app. When the prepare() method of WindcaveTapToPay is called, it will automatically check whether T&Cs are accepted, and if they are not it will then bring up Tap to Pay on iPhone T&Cs UI for the merchant to review and accept.