Skip to content

Latest commit

 

History

History
476 lines (358 loc) · 28.4 KB

File metadata and controls

476 lines (358 loc) · 28.4 KB

Profiles

Overview

Available Operations

create

Create a profile to process payments on.

Profiles are required for payment processing. Normally they are created via the Mollie dashboard. Alternatively, you can use this endpoint to automate profile creation.

Example Usage: create-profile-201-1

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.ProfileRequest;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.CreateProfileResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        CreateProfileResponse res = sdk.profiles().create()
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .profileRequest(ProfileRequest.builder()
                    .name("My website name")
                    .website("https://example.com")
                    .email("test@mollie.com")
                    .phone("+31208202070")
                    .description("My website description")
                    .countriesOfActivity(List.of(
                        "NL",
                        "GB"))
                    .businessCategory("OTHER_MERCHANDISE")
                    .build())
                .call();

        if (res.profileResponse().isPresent()) {
            System.out.println(res.profileResponse().get());
        }
    }
}

Example Usage: create-profile-201-2

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.ProfileRequest;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.CreateProfileResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        CreateProfileResponse res = sdk.profiles().create()
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .profileRequest(ProfileRequest.builder()
                    .name("My website name")
                    .website("https://example.com")
                    .email("test@mollie.com")
                    .phone("+31208202070")
                    .description("My website description")
                    .countriesOfActivity(List.of(
                        "NL",
                        "GB"))
                    .businessCategory("OTHER_MERCHANDISE")
                    .build())
                .call();

        if (res.profileResponse().isPresent()) {
            System.out.println(res.profileResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426
profileRequest ProfileRequest ✔️ N/A

Response

CreateProfileResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 403, 422 application/hal+json
models/errors/APIException 4XX, 5XX */*

list

Retrieve a list of all of your profiles.

The results are paginated.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.ListProfilesResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();


        sdk.profiles().list()
                .from("pfl_QkEhN94Ba")
                .limit(50L)
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .callAsStream()
                .forEach((ListProfilesResponse item) -> {
                   // handle page
                });

    }
}

Parameters

Parameter Type Required Description Example
from JsonNullable<String> Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the
result set.
limit JsonNullable<Long> The maximum number of items to return. Defaults to 50 items. 50
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

ListProfilesResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 400 application/hal+json
models/errors/APIException 4XX, 5XX */*

get

Retrieve a single profile by its ID.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.GetProfileResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .testmode(false)
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        GetProfileResponse res = sdk.profiles().get()
                .profileId("pfl_5B8cwPMGnU")
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .call();

        if (res.profileResponse().isPresent()) {
            System.out.println(res.profileResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
profileId String ✔️ Provide the ID of the related profile. pfl_5B8cwPMGnU
testmode Optional<Boolean> You can enable test mode by setting the testmode query parameter to true.

Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

GetProfileResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 404, 410 application/hal+json
models/errors/APIException 4XX, 5XX */*

update

Update an existing profile.

Profiles are required for payment processing. Normally they are created and updated via the Mollie dashboard. Alternatively, you can use this endpoint to automate profile management.

Example Usage: update-profile-200-1

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.UpdateProfileRequestBody;
import com.mollie.mollie.models.operations.UpdateProfileResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        UpdateProfileResponse res = sdk.profiles().update()
                .profileId("pfl_5B8cwPMGnU")
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .requestBody(UpdateProfileRequestBody.builder()
                    .name("My new website name")
                    .website("https://example.com")
                    .email("test@mollie.com")
                    .phone("+31208202071")
                    .description("My website description")
                    .countriesOfActivity(List.of(
                        "NL",
                        "GB"))
                    .businessCategory("OTHER_MERCHANDISE")
                    .build())
                .call();

        if (res.profileResponse().isPresent()) {
            System.out.println(res.profileResponse().get());
        }
    }
}

Example Usage: update-profile-200-2

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.UpdateProfileRequestBody;
import com.mollie.mollie.models.operations.UpdateProfileResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        UpdateProfileResponse res = sdk.profiles().update()
                .profileId("pfl_5B8cwPMGnU")
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .requestBody(UpdateProfileRequestBody.builder()
                    .name("My new website name")
                    .website("https://example.com")
                    .email("test@mollie.com")
                    .phone("+31208202071")
                    .description("My website description")
                    .countriesOfActivity(List.of(
                        "NL",
                        "GB"))
                    .businessCategory("OTHER_MERCHANDISE")
                    .build())
                .call();

        if (res.profileResponse().isPresent()) {
            System.out.println(res.profileResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
profileId String ✔️ Provide the ID of the related profile. pfl_5B8cwPMGnU
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426
requestBody UpdateProfileRequestBody ✔️ N/A

Response

UpdateProfileResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 403, 404, 410, 422 application/hal+json
models/errors/APIException 4XX, 5XX */*

delete

Delete a profile. A deleted profile and its related credentials can no longer be used for accepting payments.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.errors.ErrorResponse;
import com.mollie.mollie.models.operations.DeleteProfileResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorResponse, Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .organizationAccessToken(System.getenv().getOrDefault("ORGANIZATION_ACCESS_TOKEN", ""))
                    .build())
            .build();

        DeleteProfileResponse res = sdk.profiles().delete()
                .profileId("pfl_5B8cwPMGnU")
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description Example
profileId String ✔️ Provide the ID of the related profile. pfl_5B8cwPMGnU
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

DeleteProfileResponse

Errors

Error Type Status Code Content Type
models/errors/ErrorResponse 404, 410 application/hal+json
models/errors/APIException 4XX, 5XX */*

getCurrent

Retrieve the currently authenticated profile. A convenient alias of the Get profile endpoint.

For a complete reference of the profile object, refer to the Get profile endpoint documentation.

Example Usage

package hello.world;

import com.mollie.mollie.Client;
import com.mollie.mollie.models.components.Security;
import com.mollie.mollie.models.operations.GetCurrentProfileResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Client sdk = Client.builder()
                .security(Security.builder()
                    .apiKey(System.getenv().getOrDefault("API_KEY", ""))
                    .build())
            .build();

        GetCurrentProfileResponse res = sdk.profiles().getCurrent()
                .idempotencyKey("123e4567-e89b-12d3-a456-426")
                .call();

        if (res.profileResponse().isPresent()) {
            System.out.println(res.profileResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
idempotencyKey Optional<String> A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426

Response

GetCurrentProfileResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*