Packages
mollie_api
0.1.0-20260507
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/client_links_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.ClientLinksAPI do
@moduledoc """
API calls for all endpoints tagged `ClientLinksAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Create client link
Link a new or existing organization to your OAuth application, in effect creating a new client. The response contains a `clientLink` where you should redirect your customer to. ## Redirecting the Customer The `clientLink` URL behaves similarly to a standard OAuth authorization URL. Therefore, after receiving the `clientLink` URL in the API response, you need to **append the following query parameters** *before* redirecting the customer: * `client_id` _string (required)_ The client ID you received when you registered your OAuth app. The ID starts with `app_`. For example: `app_abc123qwerty`. * `state` _string (required)_ A random string **generated by your app** to prevent CSRF attacks. This will be reflected in the `state` query parameter when the user returns to the `redirect_uri` after authorizing your app. * `scope` _string (required)_ A space-separated list of permissions ('scopes') your app requires. See the [permissions list](https://docs.mollie.com/docs/permissions) for more information about the available scopes. We recommend at least : `onboarding.read onboarding.write` * `approval_prompt` _string_ Can be set to `force` to force showing the consent screen to the merchant, *even when it is not necessary*. If you force an approval prompt and the user creates a new authorization, previously active authorizations will be revoked. Possible values: `auto` `force` (default: `auto`) ### Example of a Complete Redirect URL After adding the above url parameter your URL will look something like this and you can redirect your client to this page: ``` https://my.mollie.com/dashboard/client-link/{id}?client_id={your_client_id}&state={unique_state}&scope=onboarding.read%20onboarding.write ``` ## Error Handling Error handling is also dealt with similar to the [Authorize](https://docs.mollie.com/reference/authorize) endpoint: the customer is redirected back to your app's redirect URL with the `error` and `error_description` parameters added to the URL. > 🚧 > > A client link must be used within 30 days of creation. After that period, it will expire and you will need to create a new client link.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
- `:body` (ClientLinkRequest):
### Returns
- `{:ok, MollieAPI.Model.ClientLinkResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_client_link(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ClientLinkResponse.t} | {:error, Tesla.Env.t}
def create_client_link(connection, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v2/client-links")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, MollieAPI.Model.ClientLinkResponse},
{404, MollieAPI.Model.ErrorResponse},
{422, MollieAPI.Model.ErrorResponse}
])
end
end