-
-
Notifications
You must be signed in to change notification settings - Fork 85
05. Customer API
Vincent Kok edited this page Dec 4, 2023
·
1 revision
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 single customer by its ID.
using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
CustomerResponse customerResponse = await customerClient.GetCustomerAsync(customerId);
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();
Update an existing customer.
using ICustomerClient customerClient = new CustomerClient("{yourApiKey}");
CustomerRequest updateParameters = new CustomerRequest() {
Name = "{customerName}"
};
CustomerResponse result = await customerClient.UpdateCustomerAsync("{customerIdToUpdate}", updateParameters);
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}");
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);