Inicio
Documentação
Recursos
Parcerias
Comunidade

Recursos

Confira as atualizações das nossas soluções e do funcionamento do sistema ou peça suporte técnico.

Parcerias

Conheça nosso programa para agências ou desenvolvedores que oferecem serviços de integração e vendedores que desejam contratá-los.

Comunidade

Fique por dentro das últimas novidades, peça ajuda a outros integradores e compartilhe seu conhecimento.

Salvar cartão - Cartões - Mercado Pago Developers

Busca inteligente powered by OpenAI 

Salvar cartão

POST

https://api.mercadopago.com/v1/customers/{customer_id}/cards
Armazena com segurança em nossos servidores a referência a um cartão utilizado pelo cliente no pagamento para evitar pedir todos os dados em transações futuras.
Parâmetros de requisição
PATH
customer_id
string

OBRIGATÓRIO

Customer's Id
BODY
token
string

OBRIGATÓRIO

Card Token
Parâmetros de resposta
id
string
id
expiration_month
number
expiration_month
expiration_year
number
expiration_year
first_six_digits
string
first_six_digits
Erros

400Erro

100

the credentials are required.

101

the customer already exist.

102

missing customer id.

103

parameter must be an object

104

parameter length is too large.

105

the customer id is invalid.

106

the email format is invalid.

107

the first_name is invalid.

108

the last_name is invalid.

109

the phone.area_code is invalid.

110

the phone.number is invalid.

111

the identification.type is invalid.

112

the identification.number is invalid.

113

the address.zip_code is invalid.

114

the address.street_name is invalid.

115

the date_registered format is invalid.

116

the description is invalid.

117

the metadata is invalid.

118

the body must be a Json object

119

the card is required.

120

card not found.

121

the card is invalid.

122

the card data is invalid.

123

the payment_method_id is required.

124

the issuer_id is required.

125

invalid parameters.

126

invalid parameter. You cannot update the email.

127

invalid parameter. Cannot resolve the payment method of card, check the payment_method_id and issuer_id.

128

the email format is invalid. Use 'test_payer_[0-9]{1,10}@testuser.com'.

129

the customer has reached the maximum allowed number of cards.

140

invalid card owner.

150

invalid users involved.

200

invalid range format (range=:date_parameter:after::date_from,before::date_to).

201

range attribute must belong to date entity.

202

invalid 'after' parameter. It should be date[iso_8601].

203

invalid 'before' parameter. It should be date[iso_8601].

204

invalid filters format.

205

invalid query format.

206

attributes to sort must belong to 'customer' entity.

207

order filter must be 'asc' or 'desc'.

208

invalid 'sort' parameter format.

401Erro

unauthorized

unauthorized.

404Erro

not_found

not_found.

Requisição
curl -X POST \
    'https://api.mercadopago.com/v1/customers/{customer_id}/cards'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer TEST-4599*********755-11221*********d497ae962*********ecf8d85-1*********' \
    -d '{
  "token": "9b2d63e00d66a8c721607214ceda233a"
}'
Resposta de exemplo
{
  "id": 1562188766852,
  "expiration_month": 6,
  "expiration_year": 2023,
  "first_six_digits": 423564,
  "last_four_digits": 5682,
  "payment_method": {
    "id": "visa",
    "name": "visa",
    "payment_type_id": "credit_card",
    "thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/visa.gif",
    "secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/visa.gif"
  },
  "security_code": {
    "length": 3,
    "card_location": "back"
  },
  "issuer": {
    "id": 25,
    "name": "Visa"
  },
  "cardholder": {
    "name": "APRO",
    "identification": {
      "number": 19119119100,
      "type": "CPF"
    }
  },
  "date_created": "2019-07-03T21:15:35.000Z",
  "date_last_updated": "2019-07-03T21:19:18.000Z",
  "customer_id": "448870796-7ZjwhKGxILixxN",
  "user_id": 448870796,
  "live_mode": true
}