After you have created a profile for a customer, you will be able to use the data in their profile to recognize them the next time they purchase in any of your sales channels.
Here we'll show you how to use shopper identifiers received in API responses to recognize a returning customer online or in store.
Recognize returning customers online
Before making their online purchase, your customer will provide you with an email address. They do that, for example, when creating an account for your online store, or when using your guest checkout.
To recognize whether they are a returning customer, check if their contact details match a shopperEmail
that you have stored in your customer database.
- If the email matches, they are a returning customer.
- If the email is not in your database, you can create a customer profile for them.
Showing a saved card in your online checkout
If the customer created an online store account and you have saved and tokenized their card details in a previous point-of-sale payment, you can then offer them a more frictionless online checkout experience by showing their saved card details.
To present a customer's saved card in your online checkout:
-
Using the customer's email address, fetch their
shopperReference
andrecurringDetailReference
from your customer database. -
If you are using Drop-in or Components, you can also confirm if the customer has saved card details when you make a POST /paymentMethods call. In this request, additionally include the
shopperReference
.The following example shows how to do this for a customer with a
shopperReference
of ShopperID-A16729:You receive a response containing a list of available payment methods, including the customer's stored payment details. You can find the customer's stored card in the
storedPaymentMethods
array.The example below shows what this response would look like if this customer has a stored Visa card. The
storedPaymentMethods.id
should match therecurringDetailReference
that you stored for this customer in your database. -
Present your customer's saved card details, and show a CVC/CVV field to collect their card security code.
-
If you are using Drop-in, this integration supports showing saved card details by default. For Components, you can use the stored card component for Web, iOS, or Android. Both Drop-in and Components integrations present the saved card details, and collect and encrypt your customer's card security code.
-
If you are using an API-only integration, you need to build your own UI to show the stored card details and to collect your customer's card security code. You can either build a custom card integration with encryption, or submit raw card data if you are fully PCI compliant.
-
-
If the customer chooses to pay with their saved card, continue with the payment by making a POST /payments request. In this request, additionally include:
shopperReference
: the customer'sshopperReference
, from your database.shopperInteraction
: set this to ContAuth to indicate that the customer is a returning customer.recurringProcessingModel
: set to CardOnFile to specify a one-off payment.-
paymentMethod
: an object that contains the customer's card details:recurringDetailReference
: the customer's tokenized card details.-
encryptedSecurityCode
orcvc
: the customer's card security code sent either as encrypted data (returned from Drop-in, Components, or custom card integration) or as raw data (if you are fully PCI compliant).
The following example shows how to make a payment for a customer with a
shopperReference
of ShopperID-A16729, and arecurringDetailReference
of 7219687191761347.If the payment is successful you receive a
resultCode
of Authorised.
Recognize returning customers in store
When a customer makes a purchase at the point of sale, you can check if they are a returning customer by making a card acquisition request.
Check if the card alias
returned in the response matches a card alias that you have stored in your customer database.
- If the alias matches, they are a returning customer.
- If the alias is not in your database, you can create a customer profile for them.
Apart from the card alias, the card acquisition request returns the shopperReference
if you have previously stored it on our platform. You can also use that data to check whether the customer is a returning customer.
To recognize a customer when they make a purchase at the point of sale:
-
Make a card acquisition request.
The example below shows a card acquisition request for a customer who is making a EUR 10.99 purchase.
You receive a response that includes an
AdditionalResponse
object, with a base64-encoded string that you need to decode to get a JSON object, or a string of form-encoded key-value pairs. In our examples, we use form-encoded key-value pairs. -
Use the card
alias
in theAdditionalResponse
object to look up the customer in your customer database.
If you have previously stored theshopperReference
with Adyen, this is also provided in this response.- If you have a customer profile with the same
alias
, they are a returning customer. -
If you do not have a customer profile with the same
alias
the customer's card is not recognized. This usually means that the customer is new, and has not purchased with you before. However, they could also be a returning customer using a new card.
To confirm, you can collect their email address, then check whether this matches a
shopperEmail
stored in your customer database:- If the email matches a
shopperEmail
in your database, they are a returning customer. Ask them if they want to save their new card. If they do, tokenize their new card using theirshopperReference
from your database when you make a payment. -
If the email is not your database, they are a new customer. Continue with the transaction, and create a profile for this customer.
- If you have a customer profile with the same
-
Continue with the transaction by making a payment request from your POS app, containing data returned in the card acquisition response.
If the request is successful, you receive a response containing:
POIData.POITransactionID.TransactionID
: the transaction identifier for the payment.-
PaymentResponse.Response.Result
: Success
The example result below indicates that the payment was successful. The transaction identifier for this payment is oLkO0012498220087000.981517998282382C.