Skip to content

10. Connect Api

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

Creating a authorization URL

The Authorize endpoint is the endpoint on Mollie web site where the merchant logs in, and grants authorization to your client application. E.g. when the merchant clicks on the Connect with Mollie button, you should redirect the merchant to the Authorize endpoint.

using IConnectClient client = new ConnectClient({clientId}, {clientSecret});
List<string> scopes = new List<string>() { AppPermissions.PaymentsRead };
string authorizationUrl = client.GetAuthorizationUrl({state}, scopes);

Generate token

Exchange the auth code received at the Authorize endpoint for an actual access token, with which you can communicate with the Mollie API.

using IConnectClient client = new ConnectClient({clientId}, {clientSecret});
TokenRequest request = new TokenRequest({authCode}, {redirectUrl});
TokenResponse result = client.GetAccessTokenAsync(request);

Revoke token

Revoke an access- or a refresh token. Once revoked the token can not be used anymore.

using IConnectClient client = new ConnectClient({clientId}, {clientSecret});
RevokeTokenRequest revokeTokenRequest = new RevokeTokenRequest() {
	TokenTypeHint = TokenType.AccessToken,
	Token = {accessToken}
};
TokenResponse result = client.RevokeTokenAsync(revokeTokenRequest);
Clone this wiki locally