Skip to content

11. Profile Api

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

Create profile

In order to process payments, you need to create a website profile. A website profile can easily be created via the Dashboard manually. However, the Mollie API also allows automatic profile creation via the Profiles API.

ProfileRequest profileRequest = new ProfileRequest() {
	Name = {name},
	Website = {website},
	...
};
using IProfileClient client = new ProfileClient({yourApiKey});
ProfileResponse response = client.CreateProfileAsync(profileRequest);

Get profile

Retrieve details of a profile, using the profile’s identifier.

using IProfileClient client = new ProfileClient({yourApiKey});
ProfileResponse profileResponse = await client.GetProfileAsync({profileId});

Get current profile

Use this API if you are creating a plugin or SaaS application that allows users to enter a Mollie API key, and you want to give a confirmation of the website profile that will be used in your plugin or application.

using IProfileClient client = new ProfileClient({yourApiKey});
ProfileResponse profileResponse = await client.GetCurrentProfileAsync();

Update profile

A profile is required to process payments. A profile can easily be created and updated via the Dashboard manually. However, the Mollie API also allows automatic profile creation and updates via the Profiles API.

ProfileRequest profileRequest = new ProfileRequest() {
	Name = {name},
	Website = {website},
	...
};
using IProfileClient client = new ProfileClient({yourApiKey});
ProfileResponse profileResponse = await client.UpdateProfileAsync({profileId}, profileRequest);

Enable or disable payment method

Enable or disable a payment method on a specific or authenticated profile to use it with payments.

using IProfileClient client = new ProfileClient({yourApiKey});
PaymentMethodResponse paymentMethodResponse = await profileClient.EnablePaymentMethodAsync({profileId}, PaymentMethod.Ideal);
await profileClient.DisablePaymentMethodAsync({profileId}, PaymentMethod.Ideal);

Enable or disable gift card issuer

Enable or disable a gift card issuer on a specific or authenticated profile to use it with payments.

using IProfileClient client = new ProfileClient({yourApiKey});
const string issuerToToggle = "festivalcadeau";
EnableGiftCardIssuerResponse paymentMethodResponse = await profileClient.EnableGiftCardIssuerAsync({profileId}, issuerToToggle);
await profileClient.DisableGiftCardIssuerAsync({profileId}, issuerToToggle);