# Testing

Use this guide to validate that your Loyalty integration correctly registers members, receives loyalty notifications, handles merchant activation, and supports deregistration flows.

## Overview

Before deploying your Loyalty integration to production, validate that your system can successfully:

- Register loyalty members and link payment cards
- Receive and process loyalty notifications
- Handle merchant onboarding requests
- Support on-terminal loyalty registration flows
- Process deregistration requests
- Handle repeated notifications safely


The scenarios below represent the core integration behaviours expected for Loyalty API integrations.

## Test your integration

### 1. Register a loyalty member

#### What you’re testing

Verify that your system can register a loyalty member and link their payment card for future loyalty activity.

#### Trigger

1. Create a test member in your system
2. Register the member using the Loyalty API
3. Link the payment card to the member profile


API endpoint `POST /loyalty/members`

#### Verify

- The member registration request succeeds
- The payment card is linked to the member
- Future transactions made with the card can trigger loyalty activity


#### Expected result

The payment card is linked to the member profile and can be recognised by Tyro on future transactions.

### 2. Handle `NEW_REGISTERED_CARD` notifications

#### What you’re testing

Verify that your system can receive and process NEW_REGISTERED_CARD notifications.

For on-terminal loyalty, this event may contain pre-accumulated points associated with the payment card before registration.

#### Trigger

1. Use a payment card that has accumulated pre-registration loyalty activity
2. Register the member using the Loyalty API
3. Receive the NEW_REGISTERED_CARD notification


#### Verify

- Your webhook endpoint receives the notification
- The notification is processed successfully
- Any pre-accumulated point information is handled correctly by your system


#### Expected result

Your system successfully receives and processes the NEW_REGISTERED_CARD notification.

### 3. Receive loyalty activity notifications

#### What you’re testing

Verify that Tyro sends loyalty activity notifications when a registered payment card is used in a transaction.

#### Trigger

1. Use a registered payment card to complete a transaction
2. Ensure the merchant location has completed merchant activation
3. Tyro sends a loyalty notification to your webhook endpoint


#### Verify

- Your webhook endpoint receives the loyalty notification
- The notification contains the transaction information required by your integration
- Your system can safely process repeated notifications


#### Expected result

Your system receives the loyalty notification for the registered transaction.

### 4. Test terminal-led registration

#### What you’re testing

Verify that customers can register through the on-terminal loyalty experience.

#### Trigger

1. Complete a transaction using an unregistered payment card
2. Display the loyalty sign-up QR code on the terminal
3. Complete registration using the QR code flow


#### Verify

- The QR code is displayed on the terminal
- The sign-up flow opens successfully
- The memberReference value is passed through the registration flow
- The payment card is linked after registration


#### Expected result

The customer successfully registers through the terminal-led sign-up flow and the payment card is linked to their loyalty profile.

### 5. Test merchant activation

#### What you’re testing

Verify that your system can receive and process merchant onboarding requests.

#### Trigger

1. Submit a merchant onboarding request
2. Receive a NEW_ONBOARDING_REQUEST notification
3. Retrieve the onboarding request details
4. Submit an APPROVE or REJECT decision


#### Verify

- Your system receives the onboarding notification
- The onboarding request can be retrieved successfully
- Your decision is submitted successfully
- The merchant location becomes available for loyalty activity after approval


#### Expected result

Your system successfully supports the merchant activation flow.

### 6. Deregister a payment card

#### What you’re testing

Verify that a payment card can be removed from a loyalty member profile.

#### Trigger

1. Deregister a linked payment card
2. Attempt a transaction using the deregistered card


#### Verify

- The deregistration request succeeds
- The payment card is no longer linked to the member
- Transactions using the deregistered card no longer trigger loyalty activity


#### Expected result

The deregistered payment card no longer generates loyalty activity.

### 7. Deregister a member

#### What you’re testing

Verify that a loyalty member can be removed from the loyalty program.

#### Trigger

1. Deregister the loyalty member
2. Attempt transactions using previously linked payment cards


#### Verify

- The member deregistration request succeeds
- Linked payment cards are no longer associated with the member
- Loyalty activity is no longer generated for that member


#### Expected result

The loyalty member is successfully removed from the program and no longer participates in loyalty activity.

## Error handling

Your integration should safely handle:

- Repeated notifications
- Invalid or expired member references
- Deregistered payment cards
- Merchant locations that have not completed activation
- Temporary webhook delivery failures