Skip to content

05. Customer API

Vincent Kok edited this page Dec 4, 2023 · 1 revision

Creating a new customer

Customers will appear in the Mollie Dashboard where you can manage their details, and also view their payments and subscriptions.

CustomerRequest customerRequest = new CustomerRequest() {
	Email = "{email}",
	Name = "{name}",
	Locale = Locale.nl_NL
};

using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
CustomerResponse customerResponse = await customerClient.CreateCustomerAsync(customerRequest);

Retrieve a customer by id

Retrieve a single customer by its ID.

using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
CustomerResponse customerResponse = await customerClient.GetCustomerAsync(customerId);

Retrieve customer list

Mollie allows you to set offset and count properties so you can paginate the list. The offset and count parameters are optional.

using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
ListResponse<CustomerResponse> response = await customerClient.GetCustomerListAsync();

Updating a customer

Update an existing customer.

using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
CustomerRequest updateParameters = new CustomerRequest() {
	Name = "{customerName}"
};
CustomerResponse result = await customerClient.UpdateCustomerAsync("{customerIdToUpdate}", updateParameters);

Deleting a customer

Delete a customer. All mandates and subscriptions created for this customer will be canceled as well.

using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
await customerClient.DeleteCustomerAsync("{customerIdToDelete}");

Create customer payment

Creates a payment for the customer.

PaymentRequest paymentRequest = new PaymentRequest() {
    Amount = new Amount(Currency.EUR, 100.00m),
    Description = "{description}",
    RedirectUrl = this.DefaultRedirectUrl,
};
using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
PaymentResponse result = await customerClient.CreateCustomerPayment({customerId}, paymentRequest);