Members

End-users save credits at loyalty programs through their member entity. For this entity, you may get the information of existing Members, or create new Members. These are in their essence simplistic calls and quite straightforward.



Get Member

Retrieve a Member's information and their Credit Balance for this Loyalty Program.

GETMember

https://api.piggy.nl/api//members/{member_id}

HEADERS

AuthorizationBearer {{ access_token }}

PARAMETERS

member_idnumber
REQUIREDThe Member's ID
shop_idnumber
REQUIREDShop ID

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
55012
Member not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": { "balance": 150 } }, }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": null }, }


Get Member by Email Address

Retrieve a Member's information and their Credit Balance for this Loyalty Program by email address .

GETFind Member by Email Address

https://api.piggy.nl/api//members/find-one-by?email={{email}}&shop_id={shop_id}

HEADERS

AuthorizationBearer {{ access_token }}

PARAMETERS

emailstring
REQUIREDThe Member's email address
shop_idnumber
REQUIREDShop ID

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1003
Invalid input.
55012
Member not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": { "balance": 150 } }, }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": null }, }


Create Member

Whenever an end-user wants to start saving credits at your Loyalty Program and they haven't yet started saving credits at any Loyalty Program, a new Member needs to be created for that end-user. To do so, an email address needs to be registered. If the end-user would like to use a Loyalty Card to save credits as well, a Link Loyalty Card to Member call can be used.

Keep in mind that creating a Member does not create a Customer entity for that customer. If desired, they'll need to do so themselves using either the Piggy Customer app (iOS/Android) or the Customer Dashboard.

POSTCreate Member

https://api.piggy.nl/api//members

HEADERS

AuthorizationBearer {{ access_token }}

BODY

emailstring
REQUIREDThe email address with which the Member is to be registered
shop_idnumber
REQUIREDShop ID

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1003
Invalid input.
55017
Member already exists.
1 2 3 4 5 6 { "data": { "id": 1, "email": "member@piggy.eu" } }

Update Member

Sets the Custom Attributes for the Member. Note: the Custom Attributes to be set, must already be created in the Business Dashboard. Also, make sure the Custom Attribute Name and Type match before updating. You might either get an error (in case the type is incorrect) or the Custom Attribute simply won't be set (in case the name is incorrect).

To get a better understanding of Custom Attributes, click here.

PUTUpdate Member

https://api.piggy.nl/api//members/{member_id}

HEADERS

AuthorizationBearer {{ access_token }}

PARAMETERS

member_idnumber
REQUIREDThe Member's ID

BODY

custom_attributesarray
REQUIREDArray of custom attributes that are to be set.
shop_idnumber
REQUIREDShop ID

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1003
Invalid input.
55012
Member not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "data": { "id": 1, "email": "member@piggy.eu", "created_at": "2021-01-25T12:00:00+00:00", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, }

Related