Search

Are you looking for test card numbers?

Would you like to contact support?

Omnichannel icon

Creating customer profiles

Create a profile for your customers, both online and in-store.

Before you are able to recognize a customer, you need to create a profile for them in your Customer Relationship Management System (CRM) or other database. Each customer profile should include the following customer identifiers:

  • Contact details, such as an email address. This gives you a way of contacting this customer (for example, to inform them of loyalty rewards, or to send a digital receipt).
  • A unique reference that you generate for each customer. You store this identifier with Adyen, and will use it to identify the customer when they make a purchase.
  • A token generated by Adyen representing their card details. You receive this token from Adyen when you make a payment. You can use this to offer the customer a more frictionless online checkout by showing their saved card, or create a subscription to your products or services.

You should always ask for your customer's consent before storing their personal information or tokenizing their card. For more information, see Managing customer privacy.

In this guide, we'll show you how to create a profile for a customer when you make either an online or in-store payment. You will then be able to recognize this customer the next time they make a purchase.

Create profile from online payment

Ask for customer consent

Are you using Drop-in or our Card Component? You can configure your integration to show a Save details for next time check box in your payment form.

If customers select this box, they choose to save and tokenize their card details.

When a customer makes a purchase in your web or in-app store, collect their contact details (such as their email address) in your payment form, and generate a unique reference for them.

To create a customer profile:

  1. Make a POST /payments request to initiate the payment. In this request additionally include:

    • shopperEmail: The customer's email address.
    • shopperReference: Your unique reference for this customer (minimum length three characters).
    • storePaymentMethod: Set this to true if the customer chooses to save their card details for future payments or for a subscription.

    The example below shows how you would make a 10.99 EUR payment request, store the customer's details, and request a token representing their card. This customer has the email address john.smith@example.com and the unique reference john_smith:

    Online payment request
    {
        "amount":{
            "value":1099,
            "currency":"EUR"
        },
        "paymentMethod": {
          "type": "scheme",
          "encryptedCardNumber": "test_4111111111111111",
          "encryptedExpiryMonth": "test_03",
          "encryptedExpiryYear": "test_2030",
          "encryptedSecurityCode": "test_737"
        },
        "reference":"YOUR_ORDER_NUMBER",
        "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
        "returnUrl":"https://your-company.com/...",
        "shopperReference":"john_smith",
        "shopperEmail":"john.smith@example.com",
        "storePaymentMethod":true
    }

    You receive a response containing an additionalData object. If the payment was successful this object includes:

    • shopperEmail: Customer's email address. This echoes the shopperEmail provided in the payment request.
    • shopperReference: Your unique reference for the customer. This echoes the shopperReference provided in the payment request.
    • recurringDetailReference: Token representing the customer's saved card.

    The example below is from a successful payment, where the customer's details were successfully saved with Adyen. This includes a recurringDetailReference 7219687191761347, indicating that their payment method was tokenized.

    Online payment response
    {
        "additionalData":{
            "recurring.shopperEmail":"john.smith@example.com",
            "recurring.shopperReference":"john_smith",
            "recurring.recurringDetailReference":"7219687191761347",
            ...
        },
        "pspReference":"881468919096134D",
        "resultCode":"Authorised"
    }
  2. Store the shopperEmail, shopperReference, and recurringDetailReference in your customer database. For more information, refer to Store customer data.

    You will be able to use the shopperEmail and shopperReference to recognize this customer when they make a purchase in your online or physical stores.

Next, let's find out how to create a customer profile in store, from a point-of-sale payment.

Create profile from in-store payment

Just like an online purchase, when your customer makes an in-store payment you will need to collect their contact details, and then submit these in a payment request.

To encourage your customer to provide you with their contact details, you may want to offer them incentives such as payment-linked loyalty, or the option to receive their receipt by email.

To create a customer profile from an in-store payment:

  1. Collect your customer's contact details, such as an email address.

    There are several ways you could do this. You can let your customer enter this directly on the terminal, using its touch-screen display. Alternatively, your staff could ask them for this information, then enter it in your cash register software.

    In the examples below, we will explain how to collect a customer's email address on the terminal. This will use GetText input requests, which you can initiate from your cash register. The OutputText.Text that you provide in this request will be presented to the customer.

    GetText input request
    {
      "SaleToPOIRequest": {
        "MessageHeader": {
            "ProtocolVersion":"3.0",
            "MessageClass":"Service",
            "MessageCategory":"Payment",
            "MessageType":"Request",
            "ServiceID":"0207112304",
            "SaleID":"POSSystemID12345",
            "POIID":"V400m-324688179"
        },
        "InputRequest": {
          "DisplayOutput": {
            "Device": "CustomerDisplay",
            "InfoQualify": "Display",
            "OutputContent": {
              "OutputFormat": "Text",
              "PredefinedContent": {
                "ReferenceID": "GetText"
              },
              "OutputText": [
                {"Text": "Enter your email address"}
              ]
            }
          },
          "InputData": {
            "Device": "CustomerInput",
            "InfoQualify": "Input",
            "InputCommand": "TextString",
            "MaxInputTime": 120,
            "DefaultInputString": "name@domain.com"
          }
        }
      }
    }

    An on-screen keyboard appears on the terminal, where your customer can enter their email address.

    You receive an input response when the customer has finished entering their email address. The text your customer entered is provided in the Input.TextInput.

    The example below shows what this response would look like if a customer entered john.smith@example.com as their email address.

    GetText input response
    {
      "SaleToPOIResponse": {
        "InputResponse": {
          "InputResult": {
            "Device":"CustomerInput",
            "InfoQualify":"Input",
            ...
            },
            "Input": {
              "TextInput":"john.smith@example.com",
              "InputCommand":"TextString"
            }
          },
          "OutputResult": {
            "Device":"CustomerDisplay",
            "InfoQualify":"Display",
            "Response": {
              "Result":"Success"
            }
          }
        },
        "MessageHeader": {...}
      }
    }

  1. Initiate the payment by making a payment request. In this request, additionally include the following in the PaymentRequest.SaleData object:

    • TokenRequestedType: If the customer agrees to tokenize their payment details, provide this parameter with a value of Customer. This saves the customer's card details and creates a token.
    • SaleToAcquirerData: Include the following parameters either as a JSON object converted to a base64-encoded string, or as form-encoded key-value pairs. For our example, we'll use a form-encoded key-value pair format.
      • shopperReference: Your unique reference for the customer (minimum length three characters).
      • shopperEmail: The customer's email address that you received from the GetText input response.
      • recurringContract: If the customer agrees to tokenize their payment details, provide this parameter with a value of RECURRING,ONECLICK. This creates a token that you can use for subscriptions and for future payments in your online store.

    Before saving a customer's payment details, you should ask for their consent. For more information, see Managing customer privacy.

    The example below shows how you would make a 10.99 EUR payment request, store the customer's details, and request a token representing their card. This customer has the email address john.smith@example.com and the unique reference john_smith:

    Terminal API request
    {
        "SaleToPOIRequest":{
            "MessageHeader":{
                "ProtocolVersion":"3.0",
                "MessageClass":"Service",
                "MessageCategory":"Payment",
                "MessageType":"Request",
                "ServiceID":"0207112304",
                "SaleID":"POSSystemID12345",
                "POIID":"V400m-324688179"
            },
            "PaymentRequest":{
                "SaleData":{
                    "SaleTransactionID":{
                        "TransactionID":"27958",
                        "TimeStamp":"2019-12-12T10:11:04+00:00"
                    },
                    "TokenRequestedType":"Customer",
                    "SaleToAcquirerData":"shopperReference=john_smith&shopperEmail=john.smith@example.com&recurringContract=RECURRING,ONECLICK"
                },
                "PaymentTransaction":{
                    "AmountsReq":{
                        "Currency":"EUR",
                        "RequestedAmount":10.99
                    }
                }
            }
        }
    }

    You receive a payment response containing an PaymentResponse.Response.AdditionalResponse string object. If the payment was successful the string includes:

    • shopperEmail: Customer's email address. This echoes the shopperEmail you provided in the payment request.
    • shopperReference: Your unique reference for the customer. This echoes the shopperReference you provided in the payment request.
    • recurringDetailReference: Token representing this customer's card details.
      You can use this token to offer your customer a more frictionless online checkout experience, or create a subscription to your products or services.

    The example below is from a successful payment, where the customer's details were successfully stored with Adyen. This includes a recurringDetailReference 7219687191761347, indicating that their payment method was tokenized.

    Payment response
    {
      "SaleToPOIResponse":{
        "MessageHeader":{...},
        "PaymentResponse":{
          "Response":{
            "Result":"Success",
            "AdditionalResponse":"...recurringDetailReference=8315753858208091&shopperReference=john_smith&shopperEmail=john.smith@example.com"
          },
          ...
        },
        "PaymentReceipt":{...}
      }
    }
  2. Store the shopperEmail, shopperReference, and recurringDetailReference in your customer database. For more information, refer to Store customer data.

You will be able to use the shopperEmail and shopperReference to recognize this customer when they make a purchase again whether online or in store. You can also use the shopperReference and recurringDetailReference to offer the customer a more frictionless online checkout by showing their saved card, or create a subscription to your products or services.

Store customer data

You will need to store customer data collected in your online or physical stores as a record in your CRM or other database.

In each customer profile, store the following information:

  • shopperEmail: The customer's email address.
  • shopperReference: Your unique reference for the customer.
  • recurringDetailReference: Token representing the customer's card details. In case a customer has multiple cards, create a token for each card using the same shopperReference in your payments request. Add the new recurringDetailReference returned in the response to the existing customer record. To know if a customer is using a new card, you first need to recognize the customer.

    For more information on creating and managing tokens, see our Tokenization documentation.

You will need to make the data in this record both readable and writable for all your sales channels.

Managing customer data and privacy

Before storing any customer data, including their tokenized payment method, you should consult the local laws and regulations in countries that you operate in. You should also ask for your customer's explicit permission to store this data, and be clear about what you intend to use it for.
If the customer asks to remove their information, you can use our Data Protection API to remove any customer-related data that you have stored with Adyen. The API also enables you to comply with the General Data Protection Regulation (GDPR) right to erasure mandate.

Next steps

Now that you're able to create customer profiles in your database, let's find out how you can recognize your returning customers.

You may also want to learn how to use tokens you receive from Adyen to make one-off or subscription payments.