Skip to content

User management

Here we look at how you can manage users of your Loyalty Program.

Every Fanpoints user corresponds to a user in your own system. Hence, you register a new user with your own user id. Fanpoints will also assign a unique Fanpoints User ID to each user.

For all queries, you can use both your own user id or the Fanpoints User ID interchangeably.

Add users

You can register a user in your Loyalty Program using the following function:

await client.users.addUser('user id', 'email');

Modify users

You can modify an existing user’s user id or email using the following functions:

await client.users.changeUserId('old user id', 'new user id');
await client.users.changeMailAddress('user id', 'new email');

Delete users

You can delete a user from your Loyalty Program using the following function:

await client.users.deleteUser('user id');

Get user details

You can access the details of a user using the following function:

const user = await client.users.getUser("<user_id>");
/**
* user = {
* mailAddress: 'email@mail.com',
* fanPointsUserId: '008407119295',
* userId: '<userId>',
* }
*/

Creating user wallet passes

You can generate Apple Wallet and Google Wallet passes for your users. These allow them to store their User ID and current FanPoints balance on their device. Use the following snippet to create a new pass:

const passes = await client.users.getUserPasses("your user id")
/**
* passes = {
* googleWalletPassUrl: '<some_url_to_google_wallet_pass>',
* appleWalletPassUrl: '<some_url_to_apple_wallet_pass>'
* }
*/

The user can simply open these links to add the pass to their wallet.

Displaying the credit cards of a user

You can use the following snippet to display the credit cards of a user:

const cards = await client.users.getUserCreditCards("your user id")
/**
* cards = [
* {
* cardCode: '******7629',
* cardProduct: 'FANPOINTS GOLD MC CHF PERS'
* }
* ]
*/