Transaction

@objc(DTTransaction)
public class Transaction : NSObject, DTErrorHandlerDelegate

Use this class to start a transaction with a mobileToken that has previously been initialized with a server-to-server init call.

This class is the main class to start any operation with the SDK. After the transaction has been completed - regardless if successful or not - delegate will be called with some basic information about the success or failure.

  • This delegate will be notified after a transaction has been finished, successfully or not.

    Declaration

    Swift

    @objc
    public weak var delegate: TransactionDelegate?
  • The available options for how a transaction is handled by the mobile SDK.

    Declaration

    Swift

    @objc
    public var options: TransactionOptions
  • The theme to be used by the SDK.

    Declaration

    Swift

    @objc
    public var theme: ThemeConfiguration
  • Use this init method to start the SDK with a mobile token obtained after a server-to-server init call.

    After this class is initialized, you should define its delegate, the options properties and a theme if desired.

    Declaration

    Swift

    @objc
    public init(mobileToken: String)

    Parameters

    mobileToken

    The mobileToken that has previously been initialized with a server-to-server init call.

  • Use this init method to start the SDK with a mobile token and the provided card for the transaction.

    For this to work, you can only send one payment method in your server-to-server init call. Use this init method if you use your own UI fields for the card information.

    Declaration

    Swift

    @objc
    public init(mobileToken: String, card: Card)

    Parameters

    mobileToken

    The mobileToken that has previously been initialized with a server-to-server init call.

    card

    Card object used for the transaction.

  • Use this init method to start the SDK with a mobile token and a single saved payment method.

    The payment will be started with this saved payment method.

    Declaration

    Swift

    @objc
    public init(mobileToken: String, savedPaymentMethod: SavedPaymentMethod)

    Parameters

    mobileToken

    The mobileToken that has previously been initialized with a server-to-server init call.

    savedPaymentMethod

    The saved payment method to use for this payment.

  • Use this init method to start the SDK with a mobile token and a selection of one or more saved payment methods to display.

    The user will then be able to tap on their desired saved payment method to finalize the payment.

    Declaration

    Swift

    @objc
    public init(mobileToken: String, savedPaymentMethods: [SavedPaymentMethod])

    Parameters

    mobileToken

    The mobileToken that has previously been initialized with a server-to-server init call.

    savedPaymentMethods

    Specify here the saved payment methods that are available for selection to the user.

  • Starts the SDK and displays any needed user interface using the provided presentingController. Note that a transaction can only be started once. For SwiftUI, use View.datatrans(startWithTransaction:) instead.

    Declaration

    Swift

    @objc
    public func start(presentingController: UIViewController)

    Parameters

    presentingController

    UIViewController used to present the user interface during an on-going transaction