BTShopperInsightsClientV2

public class BTShopperInsightsClientV2

Use BTShopperInsightsClientV2 to optimize your checkout experience by prioritizing the customer’s preferred payment methods in your UI.

By customizing each customer’s checkout experience, you can improve conversion, increase sales/repeat buys and boost user retention/loyalty.

The use of this client is a completely separate integration path from the deprecated BTShopperInsightsClient

Warning

This feature is in beta. It’s public API may change or be removed in future releases.

Initializers

  • Creates a BTShopperInsightsClientV2

    Warning

    This init is beta. It’s public API may change or be removed in future releases. This feature only works with a client token.

    Declaration

    Swift

    public init(authorization: String)

    Parameters

    authorization

    A valid client token or tokenization key used to authorize API calls.

Public Methods

  • This method creates a new customer session.

    Throws

    An error if the request fails for some reason or if the response is invalid.

    Warning

    This method is currently in beta and may change or be removed in future releases.

    Declaration

    Swift

    public func createCustomerSession(request: BTCustomerSessionRequest) async throws -> String

    Parameters

    request

    Return Value

    A String representing a session ID if successful

  • This method updates an existing customer session.

    Throws

    An error if the request fails for some reason or if the response is invalid.

    Warning

    This method is currently in beta and may change or be removed in future releases.

    Declaration

    Swift

    public func updateCustomerSession(request: BTCustomerSessionRequest, sessionID: String) async throws -> String

    Parameters

    request
    sessionID

    the ID of the session to update

    Return Value

    A String representing a session ID if successful

  • Generates customer recommendations

    Warning

    This method is currently in beta and may change or be removed in future releases.

    Declaration

    Swift

    public func generateCustomerRecommendations(
        request: BTCustomerSessionRequest?,
        sessionID: String?
    ) async throws -> BTCustomerRecommendationsResult

    Parameters

    request

    Optional. request type BTCustomerSessionRequest

    sessionID

    Optional. The shopper session ID

  • Call this method when the PayPal or Venmo button has been successfully displayed to the buyer. This method sends analytics to help improve the Shopper Insights feature experience.

    Warning

    This function is in beta. It’s public API may change or be removed in future releases.

    Declaration

    Swift

    public func sendPresentedEvent(for buttonType: BTButtonType, presentmentDetails: BTPresentmentDetails, sessionID: String)

    Parameters

    buttonType

    Type of button presented - PayPal, Venmo, or Other

    presentmentDetails

    Detailed information, including button order, experiment type, and page type about the payment button that is sent to analytics to help improve the Shopper Insights feature experience.

    sessionID

    The shopper session ID

  • Call this method when a button has been selected/tapped by the buyer. This method sends analytics to help improve the Shopper Insights feature experience.

    Warning

    This function is in beta. It’s public API may change or be removed in future releases.

    Declaration

    Swift

    public func sendSelectedEvent(for buttonType: BTButtonType, sessionID: String)

    Parameters

    buttonType

    Type of button presented - PayPal, Venmo, or Other

    sessionID

    The shopper session ID

  • Indicates whether the PayPal App is installed.

    Warning

    This method is currently in beta and may change or be removed in future releases.

    Declaration

    Swift

    public func isPayPalAppInstalled() -> Bool
  • Indicates whether the Venmo App is installed.

    Warning

    This method is currently in beta and may change or be removed in future releases.

    Declaration

    Swift

    public func isVenmoAppInstalled() -> Bool