Criar cliente/v1/customersCrie um cliente com todos os seus detalhes para que você possa salvar os cartões que eles usam e simplificar o processo de pagamento.
POST
Produtos relacionados:
Parâmetros de requisição
address
Localização: bodyInformação sobre o endereço padrão do clienteobject
date_registered
Localização: bodyData de registo do clienteDate(ISO_8601)
default_address
Localização: bodyEndereço padrão do clienteString
default_card
Localização: bodyCartão padrão do clienteString
Parâmetros de resposta
id
Localização: bodyIdentificador de clientestring
email
Localização: bodyE-mail do clientestring
first_name
Localização: bodyNome do clientestring
last_name
Localização: bodySobrenome do clientestring
Solicitação
curl
curl -X POST \
'https://api.mercadopago.com/v1/customers' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"email": "jhon@doe.com",
"first_name": "Jhon",
"last_name": "Doe",
"phone": {
"area_code": "55",
"number": "991234567"
},
"identification": {
"type": "CPF",
"number": "12345678900"
},
"default_address": "Home",
"address": {
"id": "123123",
"zip_code": "01234567",
"street_name": "Rua Exemplo",
"street_number": 123
},
"date_registered": "2021-10-20T11:37:30.000-04:00",
"description": "Description del user",
"default_card": "None"
}'
Resposta
json
{
"id": "000000001-sT93QZFAsfxU9P5",
"email": "jhon@doe.com",
"first_name": "Bruce",
"last_name": "Wayne",
"phone": {
"area_code": 23,
"number": 12345678
},
"identification": {
"type": "DNI",
"number": 12345678
},
"address": {
"id": "1162600094",
"zip_code": "SG1 2AX",
"street_name": "Old Knebworth Ln"
},
"description": "This is my description",
"date_created": "2018-02-20T15:36:23.541Z",
"metadata": {
"source_sync": "source_ws"
},
"default_address": "1162600094",
"cards": [
{}
],
"addresses": [
{}
],
"live_mode": true
}
Erros
400bad_request
100
101101--the customer already exist.
102102--missing customer id.
103103--parameter must be an object
104104--parameter length is too large.
105105--the customer id is invalid.
106106--the email format is invalid.
107107--the first_name is invalid.
108108--the last_name is invalid.
109109--the phone.area_code is invalid.
110110--the phone.number is invalid.
111111--the identification.type is invalid.
112112--the identification.number is invalid.
113113--the address.zip_code is invalid.
114114--the address.street_name is invalid.
115115--the date_registered format is invalid.
116116--the description is invalid.
117117--the metadata is invalid.
118118--the body must be a Json Object.
119119--the card is required.
120120--card not found.
121121--the card is invalid.
122122--the card data is invalid.
123123--the payment_method_id is required.
124124--the issuer_id is required.
125125--invalid parameters.
126126--invalid parameter. You cannot update the email.
127127--invalid parameter. Cannot resolve the payment method of card, check the payment_method_id and issuer_id.
128128--the email format is invalid. Use 'test_payer_[0-9]{1,10}@testuser.com'.
129129--the customer has reached the maximum allowed number of cards.
140140--invalid card owner.
150150--invalid users involved.
200200--invalid range format (range=:date_parameter:after::date_from,before::date_to).
201201--range attribute must belong to date entity.
202202--invalid 'after' parameter. It should be date[iso_8601].
203203--invalid 'before' parameter. It should be date[iso_8601].
204204--invalid filters format.
205205--invalid query format.
206206--attributes to sort must belong to 'customer' entity.
207207--order filter must be 'asc' or 'desc'.
208208--invalid 'sort' parameter format.
401bad_request
unauthorizedunauthorized--unauthorized.
404bad_request
not_foundnot_found--not_found.