Packages
mollie_api
0.1.0-20260409
0.1.0-20260722
0.1.0-20260721
0.1.0-20260717
0.1.0-20260716
0.1.0-20260708
0.1.0-20260702
0.1.0-20260629
0.1.0-20260625
0.1.0-20260622
0.1.0-20260619
0.1.0-20260617
0.1.0-20260615
0.1.0-20260611
0.1.0-20260609
0.1.0-20260601
0.1.0-20260529
0.1.0-20260527
0.1.0-20260526
0.1.0-20260525
0.1.0-20260521
0.1.0-20260519
0.1.0-20260515
0.1.0-20260513
0.1.0-20260512
0.1.0-20260507
0.1.0-20260505
0.1.0-20260504
0.1.0-20260430
0.1.0-20260429
0.1.0-20260428
0.1.0-20260427
0.1.0-20260423
0.1.0-20260421
0.1.0-20260420
0.1.0-20260415
0.1.0-20260410
0.1.0-20260409
0.1.0-20260408
0.1.0-20260402
0.1.0-20260401
0.1.0-20260331
0.1.0-20260330
0.1.0-20260327
0.1.0-20260317
0.1.0-20260313
0.1.0-20260310
0.1.0-20260309
0.1.0-20260306
0.1.0-20260305
0.1.0-20260303
0.1.0-20260302
0.1.0-20260226
0.1.0-20260218
0.1.0-20260217
0.1.0-20260210
0.1.0-20260206
0.1.0-20260205
0.1.0-20260204
0.1.0-20260203
0.1.0-20260202
0.1.0-20260130
0.1.0-20260129
0.1.0-20260114
0.1.0-20260109
0.1.0-20260107
0.1.0-20251222
0.1.0-20251125
0.1.0-20251121
0.1.0-20251119
0.1.0-20251118
0.1.0-20251113
An autogenerated Elixir client for the Mollie API, generated from the OpenAPI specification.
Current section
Files
Jump to
Current section
Files
lib/mollie_api/api/methods_api.ex
# NOTE: This file is auto generated by OpenAPI Generator 7.17.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule MollieAPI.Api.MethodsAPI do
@moduledoc """
API calls for all endpoints tagged `MethodsAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Disable payment method
Disable a payment method on a specific profile. When using a profile-specific API credential, the alias `me` can be used instead of the profile ID to refer to the current profile.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `profile_id` (ProfilesProfileIdMethodsMethodIdProfileIdParameter): Provide the ID of the related profile.
- `method_id` (Method): Provide the ID of the related payment method.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec disable_method(Tesla.Env.client, any(), MollieAPI.Model.Method.t, keyword()) :: {:ok, nil} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def disable_method(connection, profile_id, method_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:delete)
|> url("/profiles/#{profile_id}/methods/#{method_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{404, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Disable payment method issuer
Disable an issuer for a payment method on a specific profile. Currently only the payment methods `voucher` and `giftcard` are supported. When using a profile-specific API credential, the alias `me` can be used instead of the profile ID to refer to the current profile.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `profile_id` (ProfilesProfileIdMethodsMethodIdProfileIdParameter): Provide the ID of the related profile.
- `method_id` (MethodIdWithIssuer): Provide the ID of the related payment method.
- `issuer_id` (String.t): Provide the ID of the related issuer.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec disable_method_issuer(Tesla.Env.client, any(), MollieAPI.Model.MethodIdWithIssuer.t, String.t, keyword()) :: {:ok, nil} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def disable_method_issuer(connection, profile_id, method_id, issuer_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:delete)
|> url("/profiles/#{profile_id}/methods/#{method_id}/issuers/#{issuer_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{404, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Enable payment method
Enable a payment method on a specific profile. When using a profile-specific API credential, the alias `me` can be used instead of the profile ID to refer to the current profile. Some payment methods require extra steps in order to be activated. In cases where a step at the payment method provider needs to be completed first, the status will be set to `pending-external` and the response will contain a link to complete the activation at the provider. To enable voucher or gift card issuers, refer to the [Enable payment method issuer](enable-method-issuer) endpoint.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `profile_id` (ProfilesProfileIdMethodsMethodIdProfileIdParameter): Provide the ID of the related profile.
- `method_id` (Method): Provide the ID of the related payment method.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.EntityMethodGet.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec enable_method(Tesla.Env.client, any(), MollieAPI.Model.Method.t, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.EntityMethodGet.t} | {:error, Tesla.Env.t}
def enable_method(connection, profile_id, method_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:post)
|> url("/profiles/#{profile_id}/methods/#{method_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityMethodGet},
{404, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Enable payment method issuer
Enable an issuer for a payment method on a specific profile. Currently only the payment methods `voucher` and `giftcard` are supported. When using a profile-specific API credential, the alias `me` can be used instead of the profile ID to refer to the current profile.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `profile_id` (ProfilesProfileIdMethodsMethodIdProfileIdParameter): Provide the ID of the related profile.
- `method_id` (MethodIdWithIssuer): Provide the ID of the related payment method.
- `issuer_id` (String.t): Provide the ID of the related issuer.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
- `:body` (EnableMethodIssuerRequest):
### Returns
- `{:ok, MollieAPI.Model.EnableMethodIssuer200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec enable_method_issuer(Tesla.Env.client, any(), MollieAPI.Model.MethodIdWithIssuer.t, String.t, keyword()) :: {:ok, MollieAPI.Model.EnableMethodIssuer200Response.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def enable_method_issuer(connection, profile_id, method_id, issuer_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/profiles/#{profile_id}/methods/#{method_id}/issuers/#{issuer_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EnableMethodIssuer200Response},
{404, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Get payment method
Retrieve a single payment method by its ID. If a method is not available on this profile, a `404 Not Found` response is returned. If the method is available but not enabled yet, a status `403 Forbidden` is returned. You can enable payments methods via the [Enable payment method endpoint](enable-method) of the Profiles API, or via the Mollie Dashboard. If you do not know the method's ID, you can use the [methods list endpoint](list-methods) to retrieve all payment methods that are available. Additionally, it is possible to check if wallet methods such as Apple Pay are enabled by passing the wallet ID (`applepay`) as the method ID.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `method_id` (Method): Provide the ID of the related payment method.
- `opts` (keyword): Optional parameters
- `:locale` (Locale): Response language
- `:currency` (String.t): If provided, the `minimumAmount` and `maximumAmount` will be converted to the given currency. An error is returned if the currency is not supported by the payment method.
- `:profileId` (String.t): The identifier referring to the [profile](get-profile) you wish to retrieve the resources for. Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
- `:include` (String.t): This endpoint allows you to include additional information via the `include` query string parameter.
- `:sequenceType` (SequenceType): Set this parameter to `first` to only return the methods that can be used for the first payment of a recurring sequence. Set it to `recurring` to only return methods that can be used for recurring payments or subscriptions.
- `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter must not be sent. For organization-level credentials such as OAuth access tokens, 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.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.EntityMethodGet.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_method(Tesla.Env.client, MollieAPI.Model.Method.t, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.EntityMethodGet.t} | {:error, Tesla.Env.t}
def get_method(connection, method_id, opts \\ []) do
optional_params = %{
:locale => :query,
:currency => :query,
:profileId => :query,
:include => :query,
:sequenceType => :query,
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/methods/#{method_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityMethodGet},
{400, MollieAPI.Model.ErrorResponse},
{404, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List all payment methods
Retrieve all payment methods that Mollie offers, regardless of the eligibility of the organization for the specific method. The results of this endpoint are **not** paginated — unlike most other list endpoints in our API. The list can optionally be filtered using a number of parameters described below. ℹ️ **Note:** This endpoint only returns **online** payment methods. If you wish to retrieve the information about a non-online payment method, you can use the [Get payment method endpoint](get-method).
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:locale` (Locale): Response language
- `:amount` (Amount): If supplied, only payment methods that support the amount and currency are returned. Example: `/v2/methods/all?amount[value]=100.00&amount[currency]=USD`
- `:include` (String.t): This endpoint allows you to include additional information via the `include` query string parameter.
- `:sequenceType` (SequenceType): Set this parameter to `first` to only return the methods that can be used for the first payment of a recurring sequence. Set it to `recurring` to only return methods that can be used for recurring payments or subscriptions.
- `:profileId` (String.t): The identifier referring to the [profile](get-profile) you wish to retrieve the resources for. Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
- `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter must not be sent. For organization-level credentials such as OAuth access tokens, 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.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListAllMethods200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_all_methods(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListAllMethods200Response.t} | {:error, Tesla.Env.t}
def list_all_methods(connection, opts \\ []) do
optional_params = %{
:locale => :query,
:amount => :query,
:include => :query,
:sequenceType => :query,
:profileId => :query,
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/methods/all")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListAllMethods200Response},
{400, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List payment methods
Retrieve all enabled payment methods. The results of this endpoint are **not** paginated — unlike most other list endpoints in our API. For test mode, all pending and enabled payment methods are returned. If no payment methods are requested yet, the most popular payment methods are returned in the test mode. For live mode, only fully enabled payment methods are returned. Payment methods can be requested and enabled via the Mollie Dashboard, or via the [Enable payment method endpoint](enable-method) of the Profiles API. The list can optionally be filtered using a number of parameters described below. By default, only payment methods for the Euro currency are returned. If you wish to retrieve payment methods which exclusively support other currencies (e.g. Twint), you need to use the `amount` parameters. ℹ️ **Note:** This endpoint only returns **online** payment methods. If you wish to retrieve the information about a non-online payment method, you can use the [Get payment method endpoint](get-method).
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:sequenceType` (SequenceType): Set this parameter to `first` to only return the enabled methods that can be used for the first payment of a recurring sequence. Set it to `recurring` to only return enabled methods that can be used for recurring payments or subscriptions.
- `:locale` (Locale): Response language
- `:amount` (Amount): If supplied, only payment methods that support the amount and currency are returned. Example: `/v2/methods?amount[value]=100.00&amount[currency]=USD`
- `:resource` (MethodResourceParameter): **⚠️ We no longer recommend using the Orders API. Please refer to the [Payments API](payments-api) instead.** Indicate if you will use the result for the [Create order](create-order) or the [Create payment](create-payment) endpoint. When passing the value `orders`, the result will include payment methods that are only available for payments created via the Orders API.
- `:billingCountry` (String.t): The country taken from your customer's billing address in ISO 3166-1 alpha-2 format. This parameter can be used to check whether your customer is eligible for certain payment methods, for example for Klarna. Example: `/v2/methods?resource=orders&billingCountry=DE`
- `:includeWallets` (MethodIncludeWalletsParameter): A comma-separated list of the wallets you support in your checkout. Wallets often require wallet specific code to check if they are available on the shoppers device, hence the need to indicate your support.
- `:orderLineCategories` (LineCategories): A comma-separated list of the line categories you support in your checkout. Example: `/v2/methods?orderLineCategories=eco,meal`
- `:profileId` (String.t): The identifier referring to the [profile](get-profile) you wish to retrieve the resources for. Most API credentials are linked to a single profile. In these cases the `profileId` must not be sent. For organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
- `:include` (String.t): This endpoint allows you to include additional information via the `include` query string parameter.
- `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter must not be sent. For organization-level credentials such as OAuth access tokens, 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.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListMethods200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_methods(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListMethods200Response.t} | {:error, Tesla.Env.t}
def list_methods(connection, opts \\ []) do
optional_params = %{
:sequenceType => :query,
:locale => :query,
:amount => :query,
:resource => :query,
:billingCountry => :query,
:includeWallets => :query,
:orderLineCategories => :query,
:profileId => :query,
:include => :query,
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/methods")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListMethods200Response},
{400, MollieAPI.Model.ErrorResponse}
])
end
end