Class CustomerClient
Client with methods of Customers APIs.
Inherited Members
Namespace: MercadoPago.Client.Customer
Assembly: MercadoPago.dll
Syntax
public class CustomerClient : MercadoPagoClient<Customer>
Constructors
| Edit this page View SourceCustomerClient()
Initializes a new instance of the CustomerClient class.
Declaration
public CustomerClient()
CustomerClient(IHttpClient)
Initializes a new instance of the CustomerClient class.
Declaration
public CustomerClient(IHttpClient httpClient)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpClient | httpClient | The http client that will be used in HTTP requests. |
CustomerClient(IHttpClient, ISerializer)
Initializes a new instance of the CustomerClient class.
Declaration
public CustomerClient(IHttpClient httpClient, ISerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| IHttpClient | httpClient | The http client that will be used in HTTP requests. |
| ISerializer | serializer | The serializer that will be used to serialize the HTTP requests content and to deserialize the HTTP response content. |
CustomerClient(ISerializer)
Initializes a new instance of the CustomerClient class.
Declaration
public CustomerClient(ISerializer serializer)
Parameters
| Type | Name | Description |
|---|---|---|
| ISerializer | serializer | The serializer that will be used to serialize the HTTP requests content and to deserialize the HTTP response content. |
Methods
| Edit this page View SourceCreate(CustomerRequest, RequestOptions)
Creates a customer.
Declaration
public Customer Create(CustomerRequest request, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomerRequest | request | The data to create the customer. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| Customer | The created customer. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
CreateAsync(CustomerRequest, RequestOptions, CancellationToken)
Creates a customer as an asynchronous operation.
Declaration
public Task<Customer> CreateAsync(CustomerRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomerRequest | request | The data to create the customer. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<Customer> | A task whose the result is the created customer. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
CreateCard(string, CustomerCardCreateRequest, RequestOptions)
Creates a card for customer.
Declaration
public CustomerCard CreateCard(string customerId, CustomerCardCreateRequest request, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | customerId | Customer ID. |
| CustomerCardCreateRequest | request | Request to create the card. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| CustomerCard | The created card. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
CreateCardAsync(string, CustomerCardCreateRequest, RequestOptions, CancellationToken)
Creates a card for customer as an asynchronous operation.
Declaration
public Task<CustomerCard> CreateCardAsync(string id, CustomerCardCreateRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Customer ID. |
| CustomerCardCreateRequest | request | Request to create the card. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<CustomerCard> | A task whose the result is the created card. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
Delete(string, RequestOptions)
Delete a customer by your ID.
Declaration
public Customer Delete(string id, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer id. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| Customer | The deleted customer. |
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
DeleteAsync(string, RequestOptions, CancellationToken)
Delete async a customer by your ID.
Declaration
public Task<Customer> DeleteAsync(string id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer id. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<Customer> | A task whose the result is the deleted customer. |
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
DeleteCard(string, string, RequestOptions)
Deletes the card of the customer.
Declaration
public CustomerCard DeleteCard(string id, string cardId, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer ID. |
| string | cardId | The card ID. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| CustomerCard | The deleted customer card. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
DeleteCardAsync(string, string, RequestOptions, CancellationToken)
Deletes async the card of the customer.
Declaration
public Task<CustomerCard> DeleteCardAsync(string id, string cardId, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer ID. |
| string | cardId | The card ID. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<CustomerCard> | A task whose the result is the deleted customer card. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
Get(string, RequestOptions)
Get a customer by your ID.
Declaration
public Customer Get(string id, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer id. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| Customer | The customer. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
GetAsync(string, RequestOptions, CancellationToken)
Get async a customer by your ID.
Declaration
public Task<Customer> GetAsync(string id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer id. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<Customer> | A task whose the result is the customer. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
GetCard(string, string, RequestOptions)
Get the card of the customer.
Declaration
public CustomerCard GetCard(string id, string cardId, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer ID. |
| string | cardId | The card ID. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| CustomerCard | The customer card. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
GetCardAsync(string, string, RequestOptions, CancellationToken)
Get async the card of the customer.
Declaration
public Task<CustomerCard> GetCardAsync(string id, string cardId, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The customer ID. |
| string | cardId | The card ID. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<CustomerCard> | A task whose the result is the customer card. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
ListCards(string, RequestOptions)
List the cards of the customer.
Declaration
public ResourcesList<CustomerCard> ListCards(string id, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Customer ID. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| ResourcesList<CustomerCard> | The list of cards. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
ListCardsAsync(string, RequestOptions, CancellationToken)
List the cards of the customer as an asynchronous operation.
Declaration
public Task<ResourcesList<CustomerCard>> ListCardsAsync(string id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Customer ID. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<ResourcesList<CustomerCard>> | A task whose the result is the list of cards. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
Search(SearchRequest, RequestOptions)
Searches for customers that match the criteria of AdvancedSearchRequest.
Declaration
public ResultsResourcesPage<Customer> Search(SearchRequest request, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SearchRequest | request | The search request parameters. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| ResultsResourcesPage<Customer> | A page of customers. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
SearchAsync(SearchRequest, RequestOptions, CancellationToken)
Searches async for customers that match the criteria of AdvancedSearchRequest.
Declaration
public Task<ResultsResourcesPage<Customer>> SearchAsync(SearchRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SearchRequest | request | The search request parameters. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<ResultsResourcesPage<Customer>> | A task whose the result is a page of customers. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
Update(string, CustomerRequest, RequestOptions)
Updates a customer.
Declaration
public Customer Update(string id, CustomerRequest request, RequestOptions requestOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The ID of the customer. |
| CustomerRequest | request | The data to update the customer. |
| RequestOptions | requestOptions |
Returns
| Type | Description |
|---|---|
| Customer | The updated customer. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |
UpdateAsync(string, CustomerRequest, RequestOptions, CancellationToken)
Updates a customer as an asynchronous operation.
Declaration
public Task<Customer> UpdateAsync(string id, CustomerRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | The ID of the customer. |
| CustomerRequest | request | The data to update the customer. |
| RequestOptions | requestOptions | |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task<Customer> | A task whose the result is the updated customer. |
Remarks
Check the API documentation here.
Exceptions
| Type | Condition |
|---|---|
| MercadoPagoException | If a unexpected exception occurs. |
| MercadoPagoApiException | If the API returns a error. |