The shopping cart gathers information on the products the customer chooses while browsing a store, such as prices, shipping costs, payment methods, delivery methods, etc. This data may include item prices, shipping value, payment, and delivery methods, among others.
The information added to the customer profile can be used in the shopping cart to reduce the time the customer spends at Checkout and improve their shopping experience. For more information, read Purchasing with SmartCheckout.
This guide will describe how to get client profile information using the email address registered in your store.
Getting customer profile information
To access the customer profile information, you must use the Get client profile by email endpoint. In this request, you must send the customer's email through the URL address, as 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 in the example below:
_46..._46{_46 "userProfileId": "fb542e51-5488-4c34-8d17-ed8fcf597a94",_46 "profileProvider": "VTEX",_46 "availableAccounts": [],_46 "availableAddresses": [_46 {_46 "addressType": "residential",_46 "receiverName": "Clark Kent",_46 "addressId": "666c2e830bd9474ab6f6cc53fb6dd2d2",_46 "isDisposable": false,_46 "postalCode": "12345-000",_46 "city": "Metropolis",_46 "state": "NY",_46 "country": "USA",_46 "street": "My street",_46 "number": "123",_46 "neighborhood": "My neighborhood",_46 "complement": null,_46 "reference": null,_46 "geoCoordinates": [_46 -47.924747467041016,_46 -15.832582473754883_46 ]_46 }_46 ],_46 "userProfile": {_46 "email": "clark.kent@example.com",_46 "firstName": "Clark",_46 "lastName": "Kent",_46 "document": "12345678900",_46 "documentType": "cpf",_46 "phone": "+556199999999",_46 "corporateName": null,_46 "tradeName": null,_46 "corporateDocument": null,_46 "stateInscription": null,_46 "corporatePhone": null,_46 "isCorporate": false,_46 "profileCompleteOnLoading": null,_46 "profileErrorOnLoading": null,_46 "customerClass": null_46 },_46 "isComplete": true_46}_46...
️ Fields not completed in the customer profile will be displayed as
null
.
Error codes
The following errors may appear as a message in the response body.
200 - OK
Despite the 200
code, which indicates the success of the request, if the email used is not registered in your store or the customer profile is invalid or incomplete, the response body will not contain any customer profile information. In these conditions, the SmartCheckout feature cannot be used in the shopping cart.
_10{_10 "userProfileId": null,_10 "profileProvider": null,_10 "availableAccounts": [],_10 "availableAddresses": [],_10 "userProfile": null,_10 "isComplete": false_10}
400 - Bad Request
- Message error example (code ORD002):
"Invalid order form"
. TheorderFormId
information is not valid.
_10{_10 "fields": {},_10 "error": {_10 "code": "ORD002",_10 "message": "Invalid order form",_10 "exception": null_10 },_10 "operationId": "5d9f54e6-7db4-46d6-bca9-deeb278b8b98"_10}
404 - Not Found
- Message error example:
"The requested URL was not found on the server"
: Check if the URL is correct.
_10<body>_10 <h1>404 Not Found</h1>_10 <p>The requested URL was not found on this server.</p>_10</body>