# Loyalty cards

{% hint style="info" %}
Implementation is **OPTIONAL**
{% endhint %}

### General Flow

* Smarts shows available loyalty cards in app.
* Client will select card and fill required fields to link loyalty cards.
* Merchant will verify loyalty card and send loyalty card information to Smarts
* Smarts will send loyalty card information along with request to get client based prices and offers.
* Bonus point system can be used in app and payment process.

### Configuration

* **Create and configure new loyalty card in Smarts manager UI.**
  * Choose loyalty card type (Default, Bonus, ... etc)
  * Choose stores where this card can be used
  * Choose validation methods.
    * Currently available: identification code, card number,  phone, email
* **Implement required SDK methods for loyalty card verification**

### Implementation

You only need to create a new class, implement **`LoyaltyCardAdapter`** interface and fill all required methods.  API endpoints for loyalty card services are created automatically and secured with token.&#x20;

It is important to add `@Component` annotation on top of the class. There is no restriction for class name or location in your project. Our SDK will find your implementation based on the interface (DI).

```java
import ee.smarts.common.v1.Exceptions.LoyaltyCardException;
import ee.smarts.common.v1.requests.LoyaltyCardBonusRequest;
import ee.smarts.common.v1.requests.LoyaltyCardRegistrationRequest;
import ee.smarts.common.v1.responses.LoyaltyCardBonusResponse;
import ee.smarts.common.v1.responses.LoyaltyCardRegistrationResponse;
import ee.smarts.starter.adapter.LoyaltyCardAdapter;
import org.springframework.stereotype.Component;

@Component
public class LoyaltyCardAdapterImpl implements LoyaltyCardAdapter {

    @Override
    public LoyaltyCardRegistrationResponse register(LoyaltyCardRegistrationRequest request) throws LoyaltyCardException {
        // implement this method
        return null;
    }

    @Override
    public LoyaltyCardBonusResponse getLoyaltyCardBonus(LoyaltyCardBonusRequest request) throws LoyaltyCardException {
        // implement this method
        return null;
    }
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.smarts.ee/integration/spring-boot-starter/loyalty-cards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
