---
title: "Card and shopper identifiers for loyalty use cases"
description: "To personalize the shopping experience, recognize shoppers based on card data and other identifiers."
url: "https://docs.adyen.com/point-of-sale/loyalty/payment-data"
source_url: "https://docs.adyen.com/point-of-sale/loyalty/payment-data.md"
canonical: "https://docs.adyen.com/point-of-sale/loyalty/payment-data"
last_modified: "2026-06-01T15:33:14+02:00"
language: "en"
---

# Card and shopper identifiers for loyalty use cases

To personalize the shopping experience, recognize shoppers based on card data and other identifiers.

[View source](/point-of-sale/loyalty/payment-data.md)

![](/user/pages/docs/03.point-of-sale/36.loyalty/payment-data/postman-logo-vertical-orange-2021.svg?decoding=auto\&fetchpriority=auto)  [Postman collection](https://www.postman.com/adyendev/workspace/adyen-in-person-payments/overview)

**Implementation examples**\
![](/user/pages/reuse/development-resources/additional-info-resources/dot-net-original.svg?decoding=auto\&fetchpriority=auto)  [.NET](https://github.com/adyen-examples/adyen-dotnet-online-payments/tree/main/in-person-payments-loyalty-example)

You can use the card alias to recognize the shopper's card. But for shopper loyalty use cases you can also go one step further and create your own identifiers to be returned in card acquisition and payment responses. That enables you to identify an individual instead of just their payment card, and make the shopping experience more personal.

To use this method, you need to create customer profiles in your back-end system.

## Requirements

Before you begin, take into account the following requirements and preparations.

| Requirement          | Description                                                                                                                                                                                                                                                                                                                            |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Integration type** | A [Terminal API integration](/point-of-sale/basic-tapi-integration/) with payment terminals.                                                                                                                                                                                                                                           |
| **Setup steps**      | Before you begin:- Ask our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to check that your account is correctly configured for your loyalty use case.
- [Enable receiving identifiers in Terminal API responses](/point-of-sale/card-acquisition/identifiers#receiving-identifiers-in-responses) |

## Identifiers to save

To be able to personalize the shopper experience, save the following [identifiers](/point-of-sale/card-acquisition/identifiers) in the shopper profiles that you create in your back-end system:

* **Card alias** (`alias`): A value that uniquely represents the shopper's card number (PAN), for example **A37317672402294**. With this, you can recognize the card that a shopper is using. You cannot use the card alias for making payments. You receive the card alias in the `AdditionalResponse`.

* **Shopper reference** (`shopperReference`): Your reference to identify the shopper. You submit it with a payment, and receive it back in the `AdditionalResponse` for that payment and also in any later card acquisition and payment responses.

  To get the shopper reference, you need to [enable receiving this identifier](/point-of-sale/card-acquisition/identifiers#receiving-identifiers-in-responses).

* **Shopper email** (`shopperEmail`): You collect the shopper's email address in some way, and submit it with a payment. You receive it back in the `AdditionalResponse` for that payment and also in any later card acquisition and payment responses.

## Shopper consent and PIN entry

To save a shopper profile in your back-end system and to submit the shopper reference and email with your payment requests to our platform, you need to ask the shopper for their consent.

We can only return the shopper reference and email if your initial request also contains the **recurringProcessingModel** flag. This flag triggers the terminal to ask the shopper to authenticate by entering their PIN. Because there are still cards being used that do not have a PIN, our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) can disable asking for a PIN when the **recurringProcessingModel** flag is set. However, it goes against best practices to set this flag for every transaction.

## Synchronous flow

The synchronous flow allows you to actively engage the shopper on the spot. For example, if you recognize the shopper from a card acquisition, you can apply a discount or offer to redeem loyalty points before making the payment.

1. Make a card acquisition request to [check whether the shopper is recognized](#pre-transaction-recognition).
2. If the card acquisition response indicates the shopper is not known yet, [create a new customer profile and make a payment](#create-shopper). To ask the shopper's consent and gather the data for the customer profile, you can make input requests.
3. If the card acquisition response indicates the shopper is already known, optionally make input requests to communicate with the shopper, and then [make a payment for a recognized shopper](#payment-for-recognized-shopper).

### Check whether the shopper is recognized

When the shopper makes a purchase, first check if you already know the shopper.

If you are in Estonia, choose the *Estonian ID card check* tab below to learn how to identify the shopper with their national ID card.

### Tab: Payment card check

1. [Make a card acquisition request](/point-of-sale/card-acquisition) with:

   | Parameter                    | Required                                                                                    | Description                                                                                                                                                                                                                   |
   | ---------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | `CardAcquisitionTransaction` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | This object is either empty, or contains:- `TotalAmount`: The transaction amount.You can omit `TotalAmount` when you do not know the amount yet. Or you can also change the transaction amount later, in the payment request. |
   | `TokenRequestType`           |                                                                                             | **Customer**. Returns the card alias in the `TokenValue` field of the response. Note that the card alias is always returned in the `AdditionalResponse`.                                                                      |

   #### JSON

   ```json
   {
       "SaleToPOIRequest":{
           "MessageHeader":{
               "ProtocolVersion":"3.0",
               "MessageClass":"Service",
               "MessageCategory":"CardAcquisition",
               "MessageType":"Request",
               "SaleID":"POSSystemID12345",
               "ServiceID":"1020711110",
               "POIID":"V400m-346403161"
           },
           "CardAcquisitionRequest":{
               "SaleData":{
                   "SaleTransactionID":{
                       "TransactionID":"02072",
                       "TimeStamp":"2020-01-07T14:14:04+00:00"
                   },
                   "TokenRequestedType":"Customer"
               },
               "CardAcquisitionTransaction":{
                   "TotalAmount":24.98
               }
           }
       }
   }
   ```

   #### Java

   ```java
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";
   String transactionID = "YOUR_UNIQUE_TRANSACTION_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.CARD_ACQUISITION );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   CardAcquisitionRequest cardAcquisitionRequest = new CardAcquisitionRequest();
   SaleData saleData = new SaleData();
   TransactionIdentification saleTransactionID = new TransactionIdentification();
   saleTransactionID.setTransactionID(transactionID);
   saleTransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   saleData.setSaleTransactionID(saleTransactionID);
   saleData.setTokenRequestedType( TokenRequestedType.CUSTOMER );
   cardAcquisitionRequest.setSaleData(saleData);

   CardAcquisitionTransaction cardAcquisitionTransaction = new CardAcquisitionTransaction();
   cardAcquisitionTransaction.setTotalAmount( BigDecimal.valueOf(24.98) );
   cardAcquisitionRequest.setCardAcquisitionTransaction(cardAcquisitionTransaction);
   saleToPOIRequest.setCardAcquisitionRequest(cardAcquisitionRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

2. When you receive the [CardAcquisitionResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/cardacquisition#responses-200-Response), keep the `TimeStamp` and `TransactionID` from the `POIData.POITransactionID`. You need these details later in your payment request.

   **Card acquisition response**

   ```json
   {
       "SaleToPOIResponse": {
           "CardAcquisitionResponse": {
               "POIData": {
                   "POITransactionID": {
                       "TimeStamp": "2020-01-17T14:14:48.000Z",
                       "TransactionID": "8ha5001579009268002"
                   },
                   "SaleData": {...}
               },
               "PaymentInstrumentData": {
                   "CardData": {
                       "PaymentToken": {
                           "TokenRequestedType": "Customer",
                           "TokenValue": "M469509594859802"
                       },
                       ...
                       "PaymentBrand": "mc",
                       "MaskedPan": "541333 **** 9999",
                       "SensitiveCardData": {
                           "ExpiryDate": "0228"
                       }
                   },
                   "PaymentInstrumentType": "Card"
               },
               "Response": {
                   "Result": "Success",
                   "AdditionalResponse": "tid=46403161&transactionType=GOODS_SERVICES&backendGiftcardIndicator=false&posadditionalamounts.originalAmountValue=2370&expiryYear=2028&alias=M469509594859802&posAmountGratuityValue=0&giftcardIndicator=false&paymentMethodVariant=mc&txtime=17%3a34%3a33&iso8601TxDate=2020-01-08T16%3a34%3a33.0000000%2b0000&cardType=mc&posOriginalAmountValue=2370&aliasType=Default&txdate=08-01-2020&paymentMethod=mc&merchantReference=02076&expiryMonth=02&cardSummary=9999&posadditionalamounts.originalAmountCurrency=EUR&posAuthAmountCurrency=EUR&posAmountCashbackValue=0&posEntryMode=CLESS_CHIP&fundingSource=CREDIT&cardScheme=mc&cardBin=541333&posAuthAmountValue=2370"
               }
           },
           "MessageHeader": {...}
       }
   }
   ```

3. To verify whether you already know the shopper, check the `AdditionalResponse`. You may need to Base64-decode the string first.

   * If the `AdditionalResponse` contains a `shopperReference` and/or a `shopperEmail`, you already created a customer profile for the shopper. This means the shopper is known.

   * Or check the `alias` in the `AdditionalResponse` against the card aliases stored in your system.\
     If you specified a `TokenRequestedType` of **Customer** in the request, the card alias is also returned in `PaymentToken.TokenValue`.\
     If the shopper used an NFC wallet, there is no card alias. In that case, use the `PaymentAccountReference` instead.

4. Take the next step:

   * If the shopper is not known yet, [create a new customer profile and make a payment](#create-shopper).
   * If the shopper is already known, [make a payment for a recognized shopper](#payment-for-recognized-shopper).

### Tab: Estonian ID card check

In Estonia, you can recognize the shopper by their national ID card.

1. [Make a card acquisition request](/point-of-sale/card-acquisition) with:

   | Parameter                    | Required                                                                                    | Description                                                                                                                                                                                                                   |
   | ---------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | `CardAcquisitionTransaction` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | This object is either empty, or contains:- `TotalAmount`: The transaction amount.You can omit `TotalAmount` when you do not know the amount yet. Or you can also change the transaction amount later, in the payment request. |
   | `SaleToPOIData`              |                                                                                             | Only required in Estonia, where Estonian ID cards are used as loyalty cards. Contains the following Base64-encoded string: `"eyJPcGVyYXRpb24iOiBbeyJUeXBlIjogIlNtYXJ0Q2FyZExveWFsdHlSZWFkIn1dfQ=="`.                          |
   | `TokenRequestType`           |                                                                                             | **Customer**. Returns the card alias in the `TokenValue` field of the response. Note that the card alias is always returned in the `AdditionalResponse`.                                                                      |

   #### JSON

   ```json
   {
       "SaleToPOIRequest":{
           "MessageHeader":{
               "ProtocolVersion":"3.0",
               "MessageClass":"Service",
               "MessageCategory":"CardAcquisition",
               "MessageType":"Request",
               "SaleID":"POSSystemID12345",
               "ServiceID":"1020711110",
               "POIID":"V400m-346403161"
           },
           "CardAcquisitionRequest":{
               "SaleData":{
                   "SaleTransactionID":{
                       "TransactionID":"02072",
                       "TimeStamp":"2020-01-07T14:14:04+00:00"
                   },
                   "SaleToPOIData": "eyJPcGVyYXRpb24iOiBbeyJUeXBlIjogIlNtYXJ0Q2FyZExveWFsdHlSZWFkIn1dfQ=="
               },
               "CardAcquisitionTransaction":{
                   "TotalAmount":24.98
               }
           }
       }
   }
   ```

   #### Java

   ```java
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";
   String transactionID = "YOUR_UNIQUE_TRANSACTION_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.CARD_ACQUISITION );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   CardAcquisitionRequest cardAcquisitionRequest = new CardAcquisitionRequest();
   SaleData saleData = new SaleData();
   TransactionIdentification saleTransactionID = new TransactionIdentification();
   saleTransactionID.setTransactionID(transactionID);
   saleTransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   saleData.setSaleTransactionID(saleTransactionID);
   saleData.setSaleToPOIData("eyJPcGVyYXRpb24iOiBbeyJUeXBlIjogIlNtYXJ0Q2FyZExveWFsdHlSZWFkIn1dfQ==");
   cardAcquisitionRequest.setSaleData(saleData);

   CardAcquisitionTransaction cardAcquisitionTransaction = new CardAcquisitionTransaction();
   cardAcquisitionTransaction.setTotalAmount( BigDecimal.valueOf(24.98) );
   cardAcquisitionRequest.setCardAcquisitionTransaction(cardAcquisitionTransaction);
   saleToPOIRequest.setCardAcquisitionRequest(cardAcquisitionRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

2. When you receive the [CardAcquisitionResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/cardacquisition#responses-200-Response), keep the `TimeStamp` and `TransactionID` from the `POIData.POITransactionID`. You need these details later in your payment request.\
   Note that the `LoyaltyBrand` can be **estonian-id** or **estonian-id-cosmox**, depending on the card type.

   **Card acquisition response**

   ```json
   {
       "SaleToPOIResponse": {
           "CardAcquisitionResponse": {
                "LoyaltyAccount": [
                   {
                       "LoyaltyAccountID": {
                              "EntryMode": [
                                 "ICC"
                              ],
                             "IdentificationType": "AccountNumber",
                             "LoyaltyID": "39509101410"
                       },
                       "LoyaltyBrand": "estonian-id" 
                   }
               ],
               "POIData": {
                   "POITransactionID": {
                       "TimeStamp": "2020-01-17T14:14:48.000Z",
                       "TransactionID": "8ha5001579009268002"
                   },
                   "SaleData": {...}
               },
               "PaymentInstrumentData": {
                   "CardData": {},
                   "PaymentInstrumentType": "Card"
               },
               "Response": {
                   "Result": "Success",
                   "AdditionalResponse": "...SmartCardLoyalty.ExpiryDate=13%2003%202024&SmartCardLoyalty.FirstName=SVEN&SmartCardLoyalty.LastName=SHOPPER..."
               }
           },
           "MessageHeader": {...}
       }
   }
   ```

3. To verify whether you already know the shopper, check the `AdditionalResponse`. You may need to Base64-decode the string first.

   * If the `AdditionalResponse` contains the `FirstName` and `LastName` of the shopper and the `ExpiryDate` of card, you already created a customer profile for the shopper. This means the shopper is known.

4. Take the next step:

   * If the shopper isn't known yet, [create a new customer profile and make a payment](#create-shopper).
   * If the shopper is already known, [make a payment for a recognized shopper](#payment-for-recognized-shopper).

### Create a new customer profile and make a payment

When the card acquisition response shows the shopper is not known yet, you continue with a payment request that:

* Refers to the card acquisition request.
* Creates shopper identifiers to save in your back-end system.

1. Collect details from the shopper as needed for your use case, and ask the shopper's consent to save those details.\
   You can let your staff enter the information in your POS app, but you can also make input requests to let the shopper enter the information on the terminal. For example:

   * Make a [confirmation input request](/point-of-sale/shopper-engagement/shopper-input/confirmation) or a [signature input request](/point-of-sale/shopper-engagement/shopper-input/signature) to ask the shopper's consent.
   * Make [text input requests](/point-of-sale/shopper-engagement/shopper-input/text) to collect the shopper's name and email address, and a [digit input request](/point-of-sale/shopper-engagement/shopper-input/digit) to collect their phone number.
   * Make a [display request](/point-of-sale/shopper-engagement/display-data/display-qr-code) with a QR code containing a URL to join your loyalty program or to download an app.

2. [Make a payment request](/point-of-sale/basic-tapi-integration/make-a-payment) with:

   | Parameter                              | Required                                                                                    | Description                                                                                                                                                                                                                                                              |
   | -------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
   | `PaymentData.CardAcquisitionReference` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object referencing the card acquisition:- `TimeStamp`: The time stamp returned in the `POIData.POITransactionID` of the card acquisition response.
   - `TransactionID`: The transaction ID returned in the `POIData.POITransactionID` of the card acquisition response. |
   | `SaleData.TokenRequestedType`          |                                                                                             | **Customer**. Returns the card alias in the `TokenValue` field of the response. Note that the card alias is always returned in the `AdditionalResponse`.                                                                                                                 |
   | `SaleData.SaleToAcquirerData`          |                                                                                             | Data to create shopper identifiers.See the [instructions below](#sale-to-acquirer-data).                                                                                                                                                                                 |

   In `SaleData.SaleToAcquirerData` include:\
   []()

   * `shopperReference`: Your unique reference for this shopper. Minimum length: three characters. Note that the value is case-sensitive. Do not include personally identifiable information (PII), such as name or email address.
   * `shopperEmail`: Optional. The shopper's email address, if you collected that in the first step.
   * `recurringProcessingModel`: **CardOnFile**. This triggers us to return the shopper reference and email in future card acquisition and payment responses.

   Pass the `SaleToAcquirerData` value in one of the following formats:

   * Option 1: a JSON object converted to a Base64 encoded string. Refer to [Add information to a payment](/point-of-sale/add-data#base64-json).
   * Option 2: form-encoded key-value pairs (using **&** as a separator). For example:\
     `shopperReference=12345&shopperEmail=S.Hopper@example.com&recurringProcessingModel=CardOnFile`

   The format that you use here, will also be the format of the `AdditionalResponse` that you receive.

   #### JSON

   ```json
   {
       "SaleToPOIRequest":{
           "MessageHeader":{
               "ProtocolVersion":"3.0",
               "MessageClass":"Service",
               "MessageCategory":"Payment",
               "MessageType":"Request",
               "SaleID":"POSSystemID12345",
               "ServiceID":"01142",
               "POIID":"V400m-346403161"
           },
           "PaymentRequest":{
               "SaleData":{
                   "SaleTransactionID":{
                       "TransactionID":"12420",
                       "TimeStamp":"2020-01-07T14:15:25.114Z"
                   },
                   "SaleToAcquirerData":"shopperEmail=S.Hopper@example.com&shopperReference=YOUR_UNIQUE_SHOPPER_ID&recurringProcessingModel=CardOnFile",
                   "TokenRequestedType":"Customer"
               },
               "PaymentTransaction":{
                   "AmountsReq":{
                       "Currency":"EUR",
                       "RequestedAmount":24.98
                   }
               },
               "PaymentData":{
                   "CardAcquisitionReference":{
                       "TimeStamp": "2020-01-17T14:14:48.000Z",
                       "TransactionID": "8ha5001579009268002"
                   }
               }
           }
       }
   }
   ```

   #### Java

   ```java
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";
   String transactionID = "YOUR_UNIQUE_TRANSACTION_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.PAYMENT );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   PaymentRequest paymentRequest = new PaymentRequest();
   SaleData saleData = new SaleData();
   saleData.setSaleToAcquirerData("shopperEmail=s.hopper@example.com&shopperReference=YOUR_UNIQUE_SHOPPER_ID&recurringProcessingModel=CardOnFile");
   saleData.setTokenRequestedType( TokenRequestedType.CUSTOMER );
   TransactionIdentification saleTransactionID = new TransactionIdentification();
   saleTransactionID.setTransactionID(transactionID);
   saleTransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   saleData.setSaleTransactionID(saleTransactionID);
   paymentRequest.setSaleData(saleData);

   PaymentTransaction paymentTransaction = new PaymentTransaction();
   AmountsReq amountsReq = new AmountsReq();
   amountsReq.setCurrency("EUR");
   amountsReq.setRequestedAmount( BigDecimal.valueOf(24.98) );
   paymentTransaction.setAmountsReq(amountsReq);
   paymentRequest.setPaymentTransaction(paymentTransaction);

   PaymentData paymentData = new PaymentData();
   TransactionIdentification cardAcquisitionReference = new TransactionIdentification();
   cardAcquisitionReference.setTransactionID(transactionID);
   cardAcquisitionReference.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   paymentData.setCardAcquisitionReference(cardAcquisitionReference);
   paymentRequest.setPaymentData(paymentData);
   saleToPOIRequest.setPaymentRequest(paymentRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

3. When you receive the [PaymentResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/payment#responses-200), keep the following identifiers from the `AdditionalResponse`. You may need to Base64-decode the string first.

   * `alias`: The card alias.\
     If you specified a `TokenRequestedType` of **Customer** in the request, the card alias is also returned in `PaymentToken.TokenValue`.
   * `PaymentAccountReference`: A value that represents the shopper's payment account that their card and/or NFC wallet is linked to. For NFC wallet transactions, a PAN is not available and thus there is no card alias.
   * `shopperReference`: Your unique reference for this shopper that you specified in the request.
   * `shopperEmail`: The shopper's email address that you specified in the request.

   **Response showing the shopperReference you created**

   ```json
   {
       "SaleToPOIResponse": {
           "PaymentResponse": {
               "POIData": {...},
               "SaleData": {...},
               "PaymentReceipt": [...],
               "PaymentResult": {
                   ...
                   "PaymentInstrumentData": {
                       "CardData": {
                           "EntryMode": [
                               "Contactless"
                           ],
                       "PaymentToken": {
                           "TokenRequestedType": "Customer",
                           "TokenValue": "M469509594859802"
                       },
                       "PaymentBrand": "mc",
                       "MaskedPan": "541333 **** 9999",
                       "SensitiveCardData": {
                           "CardSeqNumb": "83",
                           "ExpiryDate": "0228"
                       }
                   },
                   "PaymentInstrumentType": "Card"
               },
               "AmountsResp": {
                   "AuthorizedAmount": 24.98,
                   "Currency": "EUR"
               },
               "Response": {
                   "Result": "Success",
                   "AdditionalResponse": "...&alias=M469509594859802...&shopperReference=YOUR_UNIQUE_SHOPPER_ID&shopperEmail=S.Hopper%40gmail.com..."
               }
           },
           "MessageHeader": {...}
       }
   }
   ```

   From now on the identifiers for this shopper are returned in card acquisition and payment responses.

4. In your system, create a customer profile for the shopper and save the shopper identifiers that you received in the payment response.

5. Also save the transaction data with the shopper's customer profile, to start building a transaction history.

### Make a payment for a recognized shopper

When the card acquisition response shows the shopper is known already, you follow up with a payment request that refers to the card acquisition.

1. Using the `shopperReference` or other identifiers you received in the card acquisition response, find the shopper in your system.

2. Depending on your business logic, you may want to apply a discount or offer a gift. For example:

   * Make a [confirmation input request](/point-of-sale/shopper-engagement/shopper-input/confirmation) to ask whether the shopper wants to redeem loyalty points.

   * Make a [display request](/point-of-sale/shopper-engagement/display-data/display-qr-code) with a QR code containing a link to a promotional offer.

3. If necessary, update the final transaction amount. For example, if you applied a discount.

4. [Make a payment request](/point-of-sale/basic-tapi-integration/make-a-payment) with:

   | Parameter                              | Required                                                                                    | Description                                                                                                                                                                                                                                                                       |
   | -------------------------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | `PaymentTransaction.AmountsReq`        | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `Currency`: The transaction [currency](/development-resources/currency-codes).
   - `RequestedAmount`: The final transaction amount.                                                                                                                                |
   | `PaymentData.CardAcquisitionReference` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object containing data from the card acquisition:- `TimeStamp`: The time stamp returned in the `POIData.POITransactionID` of the card acquisition response.
   - `TransactionID`: The transaction ID returned in the `POIData.POITransactionID` of the card acquisition response. |
   | `SaleData.TokenRequestedType`          |                                                                                             | **Customer**. Returns the card alias in the `TokenValue` field of the response. Note that the card alias is always returned in the `AdditionalResponse`.                                                                                                                          |

   #### JSON

   ```json
   {
       "SaleToPOIRequest":{
           "MessageHeader":{
               "ProtocolVersion":"3.0",
               "MessageClass":"Service",
               "MessageCategory":"Payment",
               "MessageType":"Request",
               "SaleID":"POSSystemID12345",
               "ServiceID":"01142",
               "POIID":"V400m-346403161"
           },
           "PaymentRequest":{
               "SaleData":{
                   "SaleTransactionID":{
                       "TransactionID":"12420",
                       "TimeStamp":"2020-01-07T14:15:25.114Z"
                   },
                   "TokenRequestedType":"Customer"
               },
               "PaymentTransaction":{
                   "AmountsReq":{
                       "Currency":"EUR",
                       "RequestedAmount":24.98
                   }
               },
               "PaymentData":{
                   "CardAcquisitionReference":{
                       "TimeStamp": "2020-01-17T14:14:48.000Z",
                       "TransactionID": "8ha5001579009268002"
                   }
               }
           }
       }
   }
   ```

   #### Java

   ```java
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";
   String transactionID = "YOUR_UNIQUE_TRANSACTION_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.PAYMENT );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   PaymentRequest paymentRequest = new PaymentRequest();
   SaleData saleData = new SaleData();
   saleData.setTokenRequestedType( TokenRequestedType.CUSTOMER );
   TransactionIdentification saleTransactionID = new TransactionIdentification();
   saleTransactionID.setTransactionID(transactionID);
   saleTransactionID.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   saleData.setSaleTransactionID(saleTransactionID);
   paymentRequest.setSaleData(saleData);

   PaymentTransaction paymentTransaction = new PaymentTransaction();
   AmountsReq amountsReq = new AmountsReq();
   amountsReq.setCurrency("EUR");
   amountsReq.setRequestedAmount( BigDecimal.valueOf(24.98) );
   paymentTransaction.setAmountsReq(amountsReq);
   paymentRequest.setPaymentTransaction(paymentTransaction);

   PaymentData paymentData = new PaymentData();
   TransactionIdentification cardAcquisitionReference = new TransactionIdentification();
   cardAcquisitionReference.setTransactionID(transactionID);
   cardAcquisitionReference.setTimeStamp(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
   paymentData.setCardAcquisitionReference(cardAcquisitionReference);
   paymentRequest.setPaymentData(paymentData);
   saleToPOIRequest.setPaymentRequest(paymentRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

5. When you receive the [PaymentResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/payment#responses-200), keep the following identifiers from the `AdditionalResponse`. You may need to Base64-decode the string first.

   * `alias`: The card alias.\
     If you specified a `TokenRequestedType` of **Customer** in the request, the card alias is also returned in `PaymentToken.TokenValue`.
   * `PaymentAccountReference`: A value that represents the shopper's payment account that their card and/or NFC wallet is linked to.
   * `shopperReference`: Your unique reference for this shopper, if you specified that when you [created the customer profile](#create-shopper).
   * `shopperEmail`: The shopper's email address, if you specified that when you [created the customer profile](#create-shopper).

   **Payment response for a recognized shopper**

   ```json
   {
       "SaleToPOIResponse": {
           "PaymentResponse": {
               "POIData": {...},
               "PaymentReceipt": [...],
               "PaymentResult": {
                   ...,
                   "PaymentInstrumentData": {
                       "CardData": {
                           ...,
                           "PaymentToken": {
                               "TokenRequestedType": "Customer",
                               "TokenValue": "M469509594859802"
                           },
                           "PaymentBrand": "mc",
                           "MaskedPan": "541333 **** 9999",
                           "SensitiveCardData": {
                               "CardSeqNumb": "83",
                               "ExpiryDate": "0228"
                           }
                       },
                       "PaymentInstrumentType": "Card"
                   },
                   "AmountsResp": {
                       "AuthorizedAmount": 24.98,
                       "Currency": "EUR"
                   }
               },
               "Response": {
                   "Result": "Success",
                   "AdditionalResponse": "...&alias=M469509594859802...&shopperReference=YOUR_UNIQUE_SHOPPER_ID&shopperEmail=S.Hopper%40gmail.com..."
               }
           },
           "MessageHeader": {...}
       }
   }
   ```

6. In your system, store the transaction data with the shopper's customer profile.

## Asynchronous flow

The asynchronous flow is a simpler implementation of shopper loyalty, where you rely on webhooks to make loyalty adjustments in your system after the payment. In this flow, you cannot apply discounts or other loyalty benefits on the spot before the payment.

1. Make sure that you have set up receiving [standard webhooks](/development-resources/webhooks).
2. Create a customer profile for the shopper in your loyalty system.
3. Make a payment.
4. Wait for the AUTHORISATION webhook.
5. Based on the identifiers in the AUTHORISATION webhook, update the shopper's customer profile in your loyalty system. For example, add loyalty points.
6. Inform the shopper of the update in your loyalty system.

For more information about this flow, see our [omnichannel documentation](/unified-commerce/loyalty-program/payment-linked-loyalty/?tab=asynchronous_2).

## See also

* [Loyalty with NFC wallet passes](/point-of-sale/loyalty/wallet-passes)
* [Card acquisition](/point-of-sale/card-acquisition)
* [Pass additional data](/point-of-sale/add-data)
* [Tokenization](/online-payments/tokenization)
