Remember your customers and cards - Advanced integration - Mercado Pago Developers

Remember your customers and cards

Use our APIs to save your customer's card references and offer them a better experience. This way, your customers won't need to fill out their data every time and their payments will be completed faster.

Create customers and cards

To create customers and link them with their cards, submit the e-mail field, type of payment method, ID of the issuing bank and the generated token. You will add every customer using the customer value, and cards as card.

          
<?php

  MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");

  $customer = new MercadoPago\Customer();
  $customer->email = "test_payer_12345@testuser.com";
  $customer->save();

  $card = new MercadoPago\Card();
  $card->token = "9b2d63e00d66a8c721607214cedaecda";
  $card->customer_id = $customer->id();
  $card->issuer = array("id" => "3245612");
  $card->payment_method = array("id" => "debit_card");
  $card->save();

?>


        
          
var mercadopago = require('mercadopago');
mercadopago.configure({
    access_token: 'ENV_ACCESS_TOKEN'
});

var customer_data = { "email": "test_payer_12345@testuser.com" }

mercadopago.customers.create(customer_data).then(function (customer) {

  var card_data = {
    "token": "9b2d63e00d66a8c721607214cedaecda",
    "customer_id": customer.id,
    "issuer_id": "23",
    "payment_method_id": "debit_card"
  }

  mercadopago.card.create(card_data).then(function (card) {
    console.log(card);
  });

});


        
          
MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");

CustomerClient customerClient = new CustomerClient();
CustomerCardClient customerCardClient = new CustomerCardClient();

CustomerRequest customerRequest = CustomerRequest.builder()
   .email("john@test.com")
   .build();
Customer customer = customerClient.create(customerRequest);

CustomerCardIssuer issuer = CustomerCardIssuer.builder()
   .id("3245612")
   .build();

CustomerCardCreateRequest cardCreateRequest = CustomerCardCreateRequest.builder()
   .token("9b2d63e00d66a8c721607214cedaecda")
   .issuer(issuer)
   .paymentMethodId("debit_card")
   .build();

customerCardClient.create(customer.getId(), cardCreateRequest);


        
          
require 'mercadopago'

sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')

customer_request = {
  email: 'john@yourdomain.com'
}
customer_response = sdk.customer.create(customer_request)
customer = customer_response[:response]

card_request = {
  token: '9b2d63e00d66a8c721607214cedaecda',
  issuer_id: '3245612',
  payment_method_id: 'debit_card'
}
card_response = sdk.card.create(customer['id'], card_request)
card = card_response[:response]


        
          
MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";

var customerRequest = new CustomerRequest
{
    Email = "test_payer_12345@testuser.com",
};
var customerClient = new CustomerClient();
Customer customer = await customerClient.CreateAsync(customerRequest);

var cardRequest = new CustomerCardCreateRequest
{
    Token = "9b2d63e00d66a8c721607214cedaecda"
};
CustomerCard card = await customerClient.CreateCardAsync(customer.Id, cardRequest);


        
          
import mercadopago
sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")

customer_data = {
  "email": "test_payer_12345@testuser.com"
}
customer_response = sdk.customer().create(customer_data)
customer = customer_response["response"]

card_data = {
  "token": "9b2d63e00d66a8c721607214cedaecda",
  "issuer_id": "3245612",
  "payment_method_id": "debit_card"
}
card_response = sdk.card().create(customer["id"], card_data)
card = card_response["response"]


        
          
curl -X POST \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
    'https://api.mercadopago.com/v1/customers' \
    -d '{"email": "test_payer_12345@testuser.com"}'

curl -X POST \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
    'https://api.mercadopago.com/v1/customers/CUSTOMER_ID/cards' \
    -d '{"token": "9b2d63e00d66a8c721607214cedaecda", "issuer": {"id": "3245612"}, "payment_method_id":"debit_card"}'

        

Response

json

{
    "id": "123456789-jxOV430go9fx2e",
    "email": "test_payer_12345@testuser.com",
    ...
    "default_card": "1490022319978",
    "default_address": null,
    "cards": [{
        "id": "1490022319978",
        "expiration_month": 12,
        "expiration_year": 2020,
        "first_six_digits": "415231",
        "last_four_digits": "0001",
        ...
    }],
    "addresses": [],
    "live_mode": false
}
Note
For correct data, we recommend saving card data after making a successful payment.
Important
  • If you receive an error message of type "invalid parameter" with HTTP 400 status code, make sure you are completing the fields payment_method_id and issuer_id correctly.
  • When you are using your test users, remember to follow this particular format for the customer's email: test_payer_[0-9]{1,10}@testuser.com. For example: test_payer_12345@testuser.com.
  • Add new cards to a customer

    To add new cards to a customer, create a token and make a HTTP POST to the customer.

              
    <?php
    
      MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");
    
      $customer = MercadoPago\Customer::find_by_id("247711297-jxOV430go9fx2e");
    
      $card = new MercadoPago\Card();
      $card->token = "9b2d63e00d66a8c721607214cedaecda";
      $card->customer_id = $customer->id;
      $card->issuer = array("id" => "3245612");
      $card->payment_method = array("id" => "debit_card");
      $card->save();
    
      print_r($card);
    
    ?>
    
    
            
              
    var mercadopago = require('mercadopago');
    mercadopago.configure({
        access_token: 'ENV_ACCESS_TOKEN'
    });
    
    var filters = {
      id: "247711297-jxOV430go9fx2e"
    };
    
    mercadopago.customers.search({
      qs: filters
    }).then(function (customer) {
      card_data = {
        "token": "9b2d63e00d66a8c721607214cedaecda",
        "customer_id": customer.id,
        "issuer_id": "3245612",
        "payment_method_id": "debit_card"
      }
    
      mercadopago.card.create(card_data).then(function (card) {
        console.log(card);
      });
    });
    
    
            
              
    MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");
    
    CustomerClient customerClient = new CustomerClient();
    CustomerCardClient customerCardClient = new CustomerCardClient();
    
    Customer customer = customerClient.get("247711297-jxOV430go9fx2e");
    
    CustomerCardIssuer issuer = CustomerCardIssuer.builder()
       .id("3245612")
       .build();
    
    CustomerCardCreateRequest cardCreateRequest = CustomerCardCreateRequest.builder()
       .token("9b2d63e00d66a8c721607214cedaecda")
       .issuer(issuer)
       .paymentMethodId("debit_card")
       .build();
    
    customerCardClient.create(customer.getId(), cardCreateRequest);
    
    
            
              
    require 'mercadopago'
    
    sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
    
    customer_response = sdk.customer.get('247711297-jxOV430go9fx2e')
    customer = customer_response[:response]
    
    card_request = {
      token: '9b2d63e00d66a8c721607214cedaecda',
      issuer_id: '3245612',
      payment_method_id: 'debit_card'
    }
    card_response = sdk.card.create(customer['id'], card_request)
    card = card_response[:response]
    
    puts card
    
    
            
              
    MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";
    
    var customerClient = new CustomerClient();
    Customer customer = await customerClient.GetAsync("247711297-jxOV430go9fx2e");
    
    var cardRequest = new CustomerCardCreateRequest
    {
        Token = "9b2d63e00d66a8c721607214cedaecda",
    };
    CustomerCard card = await customerClient.CreateCardAsync(customer.Id, cardRequest);
    
    Console.WriteLine(card.Id);
    
    
            
              
    import mercadopago
    sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")
    
    customer_response = sdk.customer().get("247711297-jxOV430go9fx2e")
    customer = customer_response["response"]
    
    card_data = {
      "token": "9b2d63e00d66a8c721607214cedaecda",
      "issuer_id": "3245612",
      "payment_method_id": "debit_card"
    }
    card_response = sdk.card().create(customer["id"], card_data)
    card = card_response["response"]
    
    print(card)
    
    
            
              
    curl -X GET \
      -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
      'https://api.mercadopago.com/v1/customers/CUSTOMER_ID/cards' \
    
    curl -X POST \
        -H 'Content-Type: application/json' \
        -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
        'https://api.mercadopago.com/v1/customers/CUSTOMER_ID/cards' \
        -d '{"token": "9b2d63e00d66a8c721607214cedaecda", "issuer": {"id": "3245612"}, "payment_method_id":"debit_card"}'
    
    
            

    Response

    json

    {
        "id": "1493990563105",
        "expiration_month": 12,
        "expiration_year": 2020,
        "first_six_digits": "503175",
        "last_four_digits": "0604",
        "payment_method": {
            "id": "master",
            "name": "master",
            "payment_type_id": "credit_card",
            "thumbnail": "http://img.mlstatic.com/org-img/MP3/API/logos/master.gif",
            "secure_thumbnail": "https://www.mercadopago.com/org-img/MP3/API/logos/master.gif"
        },
        "security_code": {
            "length": 3,
            "card_location": "back"
        },
        "issuer": {
            "id": 3,
            "name": "Mastercard"
        },
        "cardholder": {
            "name": "Card holdername",
    
            "identification": {
                "number": "12345678",
                "type": "DNI"
            }
    
        },
        "date_created": "2017-05-05T09:22:30.893-04:00",
        "date_last_updated": "2017-05-05T09:22:30.893-04:00",
        "customer_id": "255276729-yLOTNHQjpDWw1X",
        "user_id": "255276729",
        "live_mode": false
    }

    Use saved cards for payments

    For customers to make payments with their saved data, you need to capture the security code again. For security reasons, Mercado Pago can't save that information.


    1. Display saved cards to your customer

    First, get the saved card list so that your customer can choose one to make the payment:

              
    <?php
        $customer = MercadoPago\Customer::find_by_id($id);
        $cards = $customer->cards();
    ?>
    
    
            
              
      var filters = {
        id: customer_id
      };
    
      mercadopago.customers.search({
        qs: filters
      }).then(function (customer) {
        console.log(customer);
      });
    
    
            
              
    MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");
    
    CustomerClient customerClient = new CustomerClient();
    
    Customer customer = customerClient.get("247711297-jxOV430go9fx2e");
    customerClient.listCards(customer.getId());
    
    
            
              
    cards_response = sdk.card.list(customer_id)
    cards = cards_response[:response]
    
    
            
              
    var customerClient = new CustomerClient();
    ResourcesList<CustomerCard> customerCards = await customerClient.ListCardsAsync("CUSTOMER_ID");
    
    
            
              
    cards_response = sdk.card().list_all(customer_id)
    cards = cards_response["response"]
    
    
            
              
    curl -X GET \
        -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
        'https://api.mercadopago.com/v1/customers/CUSTOMER_ID/cards' \
    
    
            

    Saved card data response:

    json

    [{
        "id": "1490022319978",
        "expiration_month": 12,
        "expiration_year": 2020,
        "first_six_digits": "415231",
        "last_four_digits": "0001",
        ...
    }]

    And you can prepare the form like this:

    html

    <li>
       <label>Payment Method:</label>
       <select id="cardId" name="cardId"></select>
    </li>
    <li id="cvv">
       <label for="cvv">Security code:</label>
       <input type="text" id="cvv" placeholder="123" />
    </li>
    <script>
       const customerCards = [{
           "id": "3502275482333",
           "last_four_digits": "9999",
           "payment_method": {
               "name": "amex",
           },
           "security_code": {
               "length": 4,
           }
       }];
    
       // Append customer cards to select element
       const selectElement = document.getElementById('cardId');
       const tmpFragment = document.createDocumentFragment();
       customerCards.forEach(({id, last_four_digits, payment_method}) => {
           const optionElement = document.createElement('option');
           optionElement.setAttribute('value', id)
           optionElement.textContent = `${payment_method.name} ended in ${last_four_digits}`
           tmpFragment.appendChild(optionElement);
       })
       selectElement.appendChild(tmpFragment)
    </script>

    2. Capture security code

    The customer needs to enter the security code in a flow similar to card data capture. You need to create a token by submitting the form with card ID and security code.

    javascript

    (async function createToken() {
           try {
               const token = await mp.createCardToken({
                   cardId: document.getElementById('cardId').value,
                   securityCode: document.getElementById('cvv').value,
               })
    
                // Use the received token to make a POST request to your backend
               console.log('token received: ', token.id)
           }catch(e) {
               console.error('error creating token: ', e)
           }
       })()
    This documentation uses the new MercadoPago.js V2 version. To see the previous version, go to the .

    3. Create payment

    Once you get the token, you can generate the payment for the relevant amount. As the payment is made using saved card data, you need to send the customer ID along with the token.

              
    <?php
    
      MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");
    
      $payment = new MercadoPago\Payment();
    
      $payment->transaction_amount = 100;
      $payment->token = "ff8080814c11e237014c1ff593b57b4d";
      $payment->installments = 1;
      $payment->payer = array(
            "type" => "customer",
            "id" => "123456789-jxOV430go9fx2e"
        );
    
      $payment->save();
    
    ?>
    
    
            
              
    var mercadopago = require('mercadopago');
    mercadopago.configurations.setAccessToken(config.access_token);
    
    var payment_data = {
      transaction_amount: 100,
      token: 'ff8080814c11e237014c1ff593b57b4d',
      installments: 1,
      payer: {
        type: "customer"
        id: "123456789-jxOV430go9fx2e"
      }
    };
    
    mercadopago.payment.create(payment_data).then(function (data) {
      console.log(data);
    });
    
    
            
              
    MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");
    
    PaymentClient client = new PaymentClient();
    
    PaymentCreateRequest request = PaymentCreateRequest.builder()
       .transactionAmount(new BigDecimal("100"))
       .installments(1)
       .token("ff8080814c11e237014c1ff593b57b4d")
       .payer(PaymentPayerRequest.builder()
           .type("customer")
           .id("247711297-jxOV430go9fx2e")
           .build())
       .build();
    
    client.create(request);
    
    
            
              
    require 'mercadopago'
    
    sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
    
    payment_request = {
      token: 'ff8080814c11e237014c1ff593b57b4d',
      installments: 1,
      transaction_amount: 100,
      payer: {
        type: 'customer',
        id: '123456789-jxOV430go9fx2e'
      }
    }
    payment_response = sdk.payment.create(payment_request)
    payment = payment_response[:response]
    
    
            
              
    using MercadoPago.Config;
    using MercadoPago.Client.Payment;
    using MercadoPago.Resource.Payment;
    
    MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";
    
    var request = new PaymentCreateRequest
    {
        TransactionAmount = 100,
        Token = "ff8080814c11e237014c1ff593b57b4d",
        Installments = 1,
        Payer = new PaymentPayerRequest
        {
            Type = "customer",
            Email = "test_payer_12345@testuser.com",
        },
    };
    
    var client = new PaymentClient();
    Payment payment = await client.CreateAsync(request);
    
    
            
              
    import mercadopago
    sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")
    
    payment_data = {
        "transaction_amount": 100,
        "token": 'ff8080814c11e237014c1ff593b57b4d',
        "installments": 1,
        "payer": {
            "type": "customer",
            "id": "123456789-jxOV430go9fx2e"
        }
    }
    
    payment_response = sdk.payment().create(payment_data)
    payment = payment_response["response"]
    
    
            
              
    curl -X POST \
      -H 'Content-Type: application/json' \
      -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \ 
      'https://api.mercadopago.com/v1/payments' \
      -d '{
      transaction_amount: 100,
      token: "ff8080814c11e237014c1ff593b57b4d",
      installments: 1,
      payer: {
          type: "customer",
        id: "123456789-jxOV430go9fx2e"
      }
    }'
    
    
            

    Search for an existing customer

    You can search for customer information, if necessary; for example, when you don't know the assigned ID. The e-mail is the required parameter to get it.

              
    <?php
    
      $filters = array(
        "id"=>"247711297-jxOV430go9fx2e"
      );
    
      $customers = MercadoPago\Customer::search($filters);
    
    ?>
    
    
            
              
      var filters = {
        email: "test_payer_12345@testuser.com"
      };
    
      mercadopago.customers.search({
        qs: filters
      }).then(function (customer) {
        console.log(customer);
      });
    
    
            
              
    CustomerClient client = new CustomerClient();
    
    Map<String, Object> filters = new HashMap<>();
    filters.put("email", "test_payer_12345@testuser.com");
    
    MPSearchRequest searchRequest =
       MPSearchRequest.builder().offset(0).limit(0).filters(filters).build();
    
    client.search(searchRequest);
    
    
    
            
              
    customers_response = sdk.customer.search(filters: { email: 'test_payer_12345@testuser.com' })
    customers = customers_response[:response]
    
    
            
              
    var searchRequest = new SearchRequest
    {
        Filters = new Dictionary<string, object>
        {
            ["email"] = "test_payer_12345@testuser.com",
        },
    };
    ResultsResourcesPage<Customer> results = await customerClient.SearchAsync(searchRequest);
    IList<Customer> customers = results.Results;
    
    
            
              
    filters = {
        "email": "test_payer_12345@testuser.com"
    }
    
    customers_response = sdk.customer().search(filters=filters)
    customers = customers_response["response"]
    
    
            
              
    curl -X GET \
      -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
      'https://api.mercadopago.com/v1/customers/search' \
      -d '{
        "email": "test_user_19653727@testuser.com"
    }'
    
    
            

    Response

    json

    {
        "paging": {
            "limit": 10,
            "offset": 0,
            "total": 1
        },
        "results": [
            {
                "address": {
                    "id": null,
                    "street_name": null,
                    "street_number": null,
                    "zip_code": null
                },
                "addresses": [],
                "cards": [
                    {
                        ...
                    }
                ],
                "date_created": "2017-05-05T00:00:00.000-04:00",
                "date_last_updated": "2017-05-05T09:23:25.021-04:00",
                "date_registered": null,
                "default_address": null,
                "default_card": "1493990563105",
                "description": null,
                "email": "test_payer_12345@testuser.com",
                "first_name": null,
                "id": "123456789-jxOV430go9fx2e",
                "identification": {
                    "number": null,
                    "type": null
                },
                "last_name": null,
                "live_mode": false,
                "metadata": {},
                "phone": {
                    "area_code": null,
                    "number": null
                }
            }
        ]
    }

    Check customer's card list

              
    <?php
        $customer = MercadoPago\Customer::find_by_id($customer_id);
      $cards = $customer->cards();
    ?>
    
    
            
              
      var filters = {
        id: customer_id
      };
    
      mercadopago.customers.search({
        qs: filters
      }).then(function (customer) {
        console.log(customer);
      });
    
    
            
              
    MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");
    
    CustomerClient customerClient = new CustomerClient();
    
    Customer customer = customerClient.get("247711297-jxOV430go9fx2e");
    customerClient.listCards(customer.getId());
    
    
            
              
    cards_response = sdk.card.list(customer_id)
    cards = cards_response[:response]
    
    
            
              
    var customerClient = new CustomerClient();
    ResourcesList<CustomerCard> customerCards = await customerClient.ListCardsAsync("CUSTOMER_ID");
    
    
            
              
    cards_response = sdk.card().list_all(customer_id)
    cards = cards_response["response"]
      
    
            
              
    curl -X GET \
      -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
      'https://api.mercadopago.com/v1/customers/CUSTOMER_ID/cards' \
    
    
            

    Response

    json

    [{
        "id": "1490022319978",
        "expiration_month": 12,
        "expiration_year": 2020,
        "first_six_digits": "415231",
        "last_four_digits": "0001",
        ...
    }]

    Modify a customer

    To modify a client you need to send the customer_id and the fields you want to update in a HTTP PUT request.

    The fields that can be modified from a client are:

    AttributeDescription
    addressAddress.
    default_addressDefault address.
    default_cardDefault card.
    descriptionDescription.
    emailAccount e-mail.
    first_nameFirst name.
    last_nameLast name.
    phoneRegistered phone.
    identificationDocument type and number.
    Note
    The field email can only be updated if the customer has not yet associated an email.
              
    <?php
    
      MercadoPago\SDK::setAccessToken("ENV_ACCESS_TOKEN");
    
      $customer = new MercadoPago\Customer();
      $customer->email = "user@user.com";
      $customer->first_name = "john";
      $customer->last_name = "wagner";
      $customer->phone = array("area_code" => "11", "number" => "001234567");
      $customer->identification = array("type" => "CPF", "number" => "12341234");
      $customer->default_address = "Home";
      $customer->address = array("zip_code" => "52", "street_name" => "Av. das Nações Unidas", "street_number" => "2");
      $customer->description = "Customer information";
      $customer->default_card = "None";
      $customer->update();
    
    ?>
    
    
            
              
    var mercadopago = require('mercadopago');
    mercadopago.configure({
        access_token: 'ENV_ACCESS_TOKEN'
    });
    
    var customer_data = { 
      "email": "test_payer_12345@testuser.com",
      "first_name": "john" ,
      "last_name": "wagner",
      "phone": {
        "area_code": "11",
        "number": "001234567"
      },
      "identification": {
        "type": "CPF",
        "number": "12341234"
      }, 
      "default_address": "Home",
      "address": {
        "zip_code": "52",
        "street_name": "Av. das Nações Unidas",
        "street_number": "2"
      },
      "description": "Customer information",
      "default_card": "None
     }
    
    mercadopago.customers.update(customer_data).then(function (customer) {
     // code ...
    });
    
    
            
              
    MercadoPagoConfig.setAccessToken("ENV_ACCESS_TOKEN");
    
    CustomerClient client = new CustomerClient();
    
    CustomerRequest request = CustomerRequest.builder()
       .email("user@user.com")
       .firstName("John")
       .lastName("Wagner")
       .defaultAddress("Casa")
       .phone(PhoneRequest.builder()
           .areaCode("11")
           .number("001234567")
           .build())
       .identification(IdentificationRequest.builder()
           .type("CPF")
           .number("12341234")
           .build())
       .description("Informações do cliente")
       .defaultCard("None")
       .address(CustomerAddressRequest.builder()
           .zipCode("52")
           .streetName("Av. das Nações Unidas")
           .streetNumber(2)
           .build())
       .build();
    
    client.update("247711297-jxOV430go9fx2e", request);
    
    
            
              
    require 'mercadopago'
    
    sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
    
    customer_request = {
      email: 'user@user.com',
      first_name: 'john',
      last_name: 'wagner',
      default_address: 'home',
      phone: {
        area_code: '11',
        number: '001234567'
      },
      identification: {
        type: 'CPF',
        number: '12341234'
      },
      address: {
        zip_code: '52',
        street_name: 'Av. das Nações Unidas',
        street_number: '2'
      },
      description: 'Customer information',
      default_card: 'None'
    }
    customer_response = sdk.customer.update(customer_id ,customer_request)
    customer = customer_response[:response]
    
    
            
              
    MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";
    var phoneRequest = new PhoneRequest
    {
      AreaCode = "11",
      Number = "001234567"
    };
    
    var identificationRequest = new IdentificationRequest
    {
      Type = "CPF",
      Number = "12341234"
    };
    
    var addressRequest = new AddressRequest
    {
      ZipCode = "52",
      StreetName = "Av. das Nações Unidas",
      StreetNumber = "2"
    };
    
    var customerRequest = new CustomerRequest
    {
        Email = "test_payer_12345@testuser.com",
        FirstName = "john",
        LastName = "wagner",
        DefaultAddress = "home",
        Description = "Customer information",
        DefaultCard = "None",
        Phone = phoneRequest,
        Identification = identificationRequest,
        Address = addressRequest
    
    };
    var customerClient = new CustomerClient();
    Customer customer = await customerClient.Update(customerRequest);
    
    
            
              
    import mercadopago
    sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")
    
    customer_data = {
      "email": 'user@user.com',
      "first_name": 'john',
      "last_name": 'wagner',
      "default_address": 'home',
      "phone": {
        "area_code": '11',
        "number": '001234567'
      },
      "identification": {
        "type": 'CPF',
        "number": '12341234'
      },
      "address": {
        "zip_code": '52',
        "street_name": 'Av. das Nações Unidas',
        "street_number": '2'
      },
      "description": 'Customer information',
      "default_card": 'None'
    }
    customer_response = sdk.customer().update(customer_id, customer_data)
    customer = customer_response["response"]
    
    
            
              
    curl -X PUT \
        'https://api.mercadopago.com/v1/customers/{id}' \
        -H 'Authorization: Bearer ACCESS_TOKEN_ENV' \ 
        -d '{
      "email": "user@user.com",
      "first_name": "john",
      "last_name": "wagner",
      "address": {
        "zip_code": "52",
        "street_name": "Av. das Nações Unidas",
        "street_number": "2"
      },
      "phone": {
        "area_code": "11",
        "number": "001234567"
      },
      "identification": {
        "type": "CPF",
        "number": "12341234"
      },
      "description": "Customer information" 
    }'
    
    
            

    Example of response with sending the customer_id:

    json

    {
      "id": "xxxxxxxxxxxxxxxxxxxxx",
      "email": "user@user.com",
      "first_name": "john",
      "last_name": "wagner",
      "phone": {
        "area_code": "11",
        "number": 001234567
      },
      "identification": {
        "type": "CPF",
        "number": 12341234
      },
      "address": {
        "zip_code": "52",
        "street_name": "Av. das Nações Unidas",
        "street_number": 2
      },
      "description": "Customer information",
      "date_created": "2021-05-25T15:36:23.541Z",
      "metadata": {},
      "cards": [
        {}
      ],
      "addresses": [
        {}
      ]
    }

    Example of response without including the customers_id parameter:

    json

    {
      "message": "missing customer id"
    }
    Note
    If you don't have the customer_id, and generate an HTTP GET request using the email parameter to get it.