The shopping cart is where the information on the products chosen by the customer while browsing a store is gathered. This data may include item prices, shipping value, payment, and delivery methods, among others.
To reduce the time spent by the customer at Checkout and improve their shopping experience, the information registered in the client's profile can be used in the shopping cart. For more information, visit Purchasing with SmartCheckout.
This guide will describe how to obtain a client profile information using the email address registered in your store.
Accessing client profile information
To access the client profile information, you must use the Get client profile by email endpoint. In this request, the client’s email must be sent through the URL address, as shown in the example below:
https://{accountname}.{environment.com.br}/api/checkout/pub/profiles?email=test1@test2.com
After sending the request, the endpoint will return the response body containing the client profile information, as shown in the example below:
...
{
"userProfileId": "fb542e51-5488-4c34-8d17-ed8fcf597a94",
"profileProvider": "VTEX",
"availableAccounts": [],
"availableAddresses": [
{
"addressType": "residential",
"receiverName": "Clark Kent",
"addressId": "666c2e830bd9474ab6f6cc53fb6dd2d2",
"isDisposable": false,
"postalCode": "12345-000",
"city": "Metropolis",
"state": "NY",
"country": "USA",
"street": "My street",
"number": "123",
"neighborhood": "My neighborhood",
"complement": null,
"reference": null,
"geoCoordinates": [
-47.924747467041016,
-15.832582473754883
]
}
],
"userProfile": {
"email": "clark.kent@example.com",
"firstName": "Clark",
"lastName": "Kent",
"document": "12345678900",
"documentType": "cpf",
"phone": "+556199999999",
"corporateName": null,
"tradeName": null,
"corporateDocument": null,
"stateInscription": null,
"corporatePhone": null,
"isCorporate": false,
"profileCompleteOnLoading": null,
"profileErrorOnLoading": null,
"customerClass": null
},
"isComplete": true
}
...
️ Fields that were not registered in the customer’s profile will be displayed as
null.
Error codes
The following errors may appear as a message in the response body.
200 - OK
Despite the code 200 (which indicates the success of the request), if the email used is not registered in your store or the client profile is invalid or incomplete, the response body will not contain any customer profile information. In these conditions, the SmartCheckout feature can not be used in the shopping cart.
{
"userProfileId": null,
"profileProvider": null,
"availableAccounts": [],
"availableAddresses": [],
"userProfile": null,
"isComplete": false
}
400 - Bad Request
- Message error example (code ORD002):
"Invalid order form". TheorderFormIdinformation is not valid.
{
"fields": {},
"error": {
"code": "ORD002",
"message": "Invalid order form",
"exception": null
},
"operationId": "5d9f54e6-7db4-46d6-bca9-deeb278b8b98"
}
404 - Not Found
- Message error example:
"The requested URL was not found on the server": check that the URL data is correct.
<body>
<h1>404 Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body>