Customers - Net - Mercado Pago Developers
What are you looking for?

Do not know how to start integrating? 

Check the first steps

Create customer

It is possible to create customers using the SDK below. For details on the request parameters, check the Create customer API.

          
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);


        

Search customers

It is possible to search customers using the SDK below. For details on the request parameters, check the Search customer API.

          
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;


        

Update customer

It is possible to update customers using the SDK below. For details on the request parameters, check the Update customer API.

          
MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";
var phoneRequest = new PhoneRequest
{
  AreaCode = "11",
  Number = "001234567"
};

var identificationRequest = new IdentificationRequest
{
  Type = "RUT",
  Number = "12341234"
};

var addressRequest = new AddressRequest
{
  ZipCode = "52",
  StreetName = "Av. Apoquindo",
  StreetNumber = "2"
};

var customerRequest = new CustomerRequest
{
    Email = "test_payer_12345@testuser.com",
    FirstName = "john",
    LastName = "wagner",
    DefaultAddress = "home",
    Description = "Informações do cliente",
    DefaultCard = "None",
    Phone = phoneRequest,
    Identification = identificationRequest,
    Address = addressRequest

};
var customerClient = new CustomerClient();
Customer customer = await customerClient.Update(customerRequest);