SessionDelegate

@objc
public protocol SessionDelegate : AnyObject, NSObjectProtocol

Payment delegate.

  • Notifies the receiver that payment has succeed, passing charge and session which has initiated payment as arguments.

    Declaration

    Swift

    @objc(paymentSucceed:onSession:)
    optional func paymentSucceed(_ charge: Charge, on session: SessionProtocol)

    Parameters

    charge

    Successful charge object.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that authorization has succeed, passing authorize and session which has initiated authorization as arguments.

    Declaration

    Swift

    @objc(authorizationSucceed:onSession:)
    optional func authorizationSucceed(_ authorize: Authorize, on session: SessionProtocol)

    Parameters

    authorize

    Successful authorization object.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that the card was saved.

    Declaration

    Swift

    @objc(cardSaved:onSession:)
    optional func cardSaved(_ cardVerification: CardVerification, on session: SessionProtocol)

    Parameters

    cardVerification

    CardVerification object with the details.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that the card was tokenized.

    Declaration

    Swift

    @objc(cardTokenized:onSession:customerRequestedToSaveTheCard:)
    optional func cardTokenized(_ token: Token, on session: SessionProtocol, customerRequestedToSaveTheCard saveCard: Bool)

    Parameters

    token

    Created token.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

    saveCard

    Defines if the customer has requested to save the card.

  • Notifies the receiver that charge has failed, passing session which has initiated the payment.

    If error is nil, then look into charge object to find the cause of the issue.

    Declaration

    Swift

    @objc(paymentFailedWithCharge:error:onSession:)
    optional func paymentFailed(with charge: Charge?, error: TapSDKError?, on session: SessionProtocol)

    Parameters

    charge

    Charge that has failed (if reached the stage of charging).

    error

    Error that has occured.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that authorization has failed, passing session which has initiated the authorization.

    If error is nil, then look into authorize object to find the cause of the issue.

    Declaration

    Swift

    @objc(authorizationFailedWithAuthorize:error:onSession:)
    optional func authorizationFailed(with authorize: Authorize?, error: TapSDKError?, on session: SessionProtocol)

    Parameters

    authorize

    Authorize object that has failed (if reached the stage of authorization).

    error

    Error that has occured.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that card saving process has failed.

    If error is nil, then look into cardVerification object to find the cause of the issue.

    Declaration

    Swift

    @objc(cardSavingFailedWithCardVerification:error:onSession:)
    optional func cardSavingFailed(with cardVerification: CardVerification?, error: TapSDKError?, on session: SessionProtocol)

    Parameters

    cardVerification

    Card verification object.

    error

    Error that has occured.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that card tokenization process has failed.

    Declaration

    Swift

    @objc(cardTokenizationFailedWithError:onSession:)
    optional func cardTokenizationFailed(with error: TapSDKError, on session: SessionProtocol)

    Parameters

    error

    Error that has occured.

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that session is about to start and has not yet shown the SDK UI.

    You might want to use this method if you are not using PayButton in your application and want to show a loader before SDK UI appears on the screen.

    Declaration

    Swift

    @objc
    optional func sessionIsStarting(_ session: SessionProtocol)

    Parameters

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that session has successfully started and shown the SDK UI on the screen.

    You might want to use this method if you are not using PayButton in your application and want to hide a loader after SDK UI has appeared on the screen.

    Declaration

    Swift

    @objc
    optional func sessionHasStarted(_ session: SessionProtocol)

    Parameters

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that session has failed to start and will not show the SDK UI on the screen.

    You might want to use this method if you are not using PayButton in your application and want to hide a loader because the session has failed. For the actual failure cause please implement other methods from this protocol and listen to the callbacks.

    Declaration

    Swift

    @objc
    optional func sessionHasFailedToStart(_ session: SessionProtocol)

    Parameters

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.

  • Notifies the receiver that session has been cancelled by the user.

    Declaration

    Swift

    @objc
    optional func sessionCancelled(_ session: SessionProtocol)

    Parameters

    session

    Session object. It might be either a PayButton instance or Session instance if you are not using PayButton in your application.