This class allows you manage users in your loyalty program. A user corresponds to a person who can participate in your loyalty program (e.g. earn and spend points).

Methods

  • Adds a user to your loyalty program. A user corresponds to a person who can participate in your FanPoints loyalty program (e.g. earn and spend points).

    The user ID must be unique within your loyalty program. Both the user ID and the email address can be changed later using the changeUserId and changeMailAddress methods.

    Parameters

    • userId: string

      The ID associated to the user in your system.

    • mailAddress: string

      The email address of the user.

    Returns Promise<{
        addresses: undefined | {
            city: string;
            country: string;
            street: string;
            zipCode: string;
        }[];
        fanPointsUserId: string;
        mailAddress: string;
        name: undefined | string;
        userId: string;
    }>

    RequestError if a user with the given ID already exists (userAlreadyExistsError), the userId is invalid (invalidUserIdError) or the email address is invalid (invalidMailAddressError).

  • Changes the additional user info of a user in your loyalty program.

    Parameters

    • userId: string

      The user ID of the user.

    • name: string

      The new name of the user.

    • addresses: {
          city: string;
          country: string;
          street: string;
          zipCode: string;
      }[]

      The new addresses of the user.

    Returns Promise<undefined>

    RequestError if the user does not exist (unknownUserError).

  • Changes the email address of a user in your loyalty program.

    Parameters

    • userId: string

      The user ID of the user.

    • newMailAddress: string

      The new email address of the user.

    Returns Promise<undefined>

    RequestError if the user does not exist (unknownUserError) or the email address is invalid (invalidMailAdressError).

  • Changes the user ID of a user in your loyalty program.

    The new user ID must be unique within your loyalty program. The data connected to the user (e.g. points, transactions) will be preserved.

    Parameters

    • oldUserId: string

      The current user ID of the user.

    • newUserId: string

      The new user ID of the user.

    Returns Promise<undefined>

    RequestError if the old user does not exist (unknownUserError), the new user ID is invalid (invalidUserIdError) or the new user ID is already taken (userAlreadyExistsError).

  • Deletes a user from your loyalty program.

    Parameters

    • userId: string

      The user ID of the user.

    Returns Promise<undefined>

    RequestError if the user does not exist (unknownUserError).

  • Retrieves information on a user from your loyalty program.

    Parameters

    • userId: string

      The user ID of the user.

    Returns Promise<{
        addresses: undefined | {
            city: string;
            country: string;
            street: string;
            zipCode: string;
        }[];
        fanPointsUserId: string;
        mailAddress: string;
        name: undefined | string;
        userId: string;
    }>

    an object containing the user's ID and email address.

    RequestError if the user does not exist (unknownUserError).

  • Retrieves links to the user's Apple Wallet and Google Wallet pass.

    Parameters

    • userId: string

      The user ID of the user.

    Returns Promise<{
        appleWalletPassUrl: string;
        googleWalletPassUrl: string;
    }>

    an object containing URLs to the user's Apple Wallet and Google Wallet pass.

    RequestError if the user does not exist (unknownUserError).