Developer-friendly & type-safe Csharp SDK specifically catered to leverage Mollie API.
Important
This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.
To add the NuGet package to a .NET project:
dotnet add package Mollie
To add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/Mollie/Mollie.csproj
using Mollie;
using Mollie.Models.Components;
using Mollie.Models.Requests;
using System.Collections.Generic;
var sdk = new Client(security: new Security() {
ApiKey = "<YOUR_BEARER_TOKEN_HERE>",
});
var res = await sdk.Payments.CreateAsync(
include: CreatePaymentInclude.DetailsQrCode,
requestBody: new CreatePaymentRequestBody() {
Description = "Chess Board",
Amount = new CreatePaymentAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
RedirectUrl = "https://example.org/redirect",
CancelUrl = "https://example.org/cancel",
WebhookUrl = "https://example.org/webhooks",
Lines = new List<CreatePaymentLineRequest>() {
new CreatePaymentLineRequest() {
Description = "LEGO 4440 Forest Police Station",
Quantity = 1,
QuantityUnit = "pcs",
UnitPrice = new CreatePaymentUnitPriceRequest() {
Currency = "EUR",
Value = "10.00",
},
DiscountAmount = new CreatePaymentDiscountAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
TotalAmount = new CreatePaymentTotalAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
VatRate = "21.00",
VatAmount = new CreatePaymentVatAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Sku = "9780241661628",
Categories = new List<CreatePaymentCategoryRequest>() {
CreatePaymentCategoryRequest.Meal,
CreatePaymentCategoryRequest.Eco,
},
ImageUrl = "https://...",
ProductUrl = "https://...",
Recurring = new CreatePaymentRecurringRequest() {
Description = "Gym subscription",
Interval = CreatePaymentIntervalRequest.DotDotDotDays,
Amount = new CreatePaymentRecurringAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Times = 1,
StartDate = "2024-12-12",
},
},
},
BillingAddress = new CreatePaymentBillingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
ShippingAddress = new CreatePaymentShippingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
Locale = CreatePaymentLocaleRequest.EnUS,
Method = CreatePaymentMethodRequest.Ideal,
Issuer = "ideal_INGBNL2A",
RestrictPaymentMethodsToCountry = "NL",
CaptureMode = CreatePaymentCaptureModeRequest.Manual,
CaptureDelay = "8 hours",
ApplicationFee = new CreatePaymentApplicationFeeRequest() {
Amount = new CreatePaymentApplicationFeeAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Description = "10",
},
Routing = new List<CreatePaymentRoutingRequest>() {
new CreatePaymentRoutingRequest() {
Amount = new CreatePaymentRoutingAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Destination = new CreatePaymentDestinationRequest() {
Type = CreatePaymentRoutingTypeRequest.Organization,
OrganizationId = "org_1234567",
},
ReleaseDate = "2024-12-12",
Links = new CreatePaymentLinksRequest() {
Self = new CreatePaymentSelfRequest() {
Href = "https://...",
Type = "application/hal+json",
},
Payment = new CreatePaymentPaymentRequest() {
Href = "https://...",
Type = "application/hal+json",
},
},
},
},
MandateId = "mdt_5B8cwPMGnU",
CustomerId = "cst_5B8cwPMGnU",
ProfileId = "pfl_5B8cwPMGnU",
DueDate = "2025-01-01",
Testmode = false,
}
);
// handle response
This SDK supports the following security schemes globally:
Name | Type | Scheme |
---|---|---|
ApiKey |
http | HTTP Bearer |
OAuth |
oauth2 | OAuth2 token |
You can set the security parameters through the security
optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
using Mollie;
using Mollie.Models.Components;
using Mollie.Models.Requests;
using System.Collections.Generic;
var sdk = new Client(security: new Security() {
ApiKey = "<YOUR_BEARER_TOKEN_HERE>",
});
var res = await sdk.Payments.CreateAsync(
include: CreatePaymentInclude.DetailsQrCode,
requestBody: new CreatePaymentRequestBody() {
Description = "Chess Board",
Amount = new CreatePaymentAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
RedirectUrl = "https://example.org/redirect",
CancelUrl = "https://example.org/cancel",
WebhookUrl = "https://example.org/webhooks",
Lines = new List<CreatePaymentLineRequest>() {
new CreatePaymentLineRequest() {
Description = "LEGO 4440 Forest Police Station",
Quantity = 1,
QuantityUnit = "pcs",
UnitPrice = new CreatePaymentUnitPriceRequest() {
Currency = "EUR",
Value = "10.00",
},
DiscountAmount = new CreatePaymentDiscountAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
TotalAmount = new CreatePaymentTotalAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
VatRate = "21.00",
VatAmount = new CreatePaymentVatAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Sku = "9780241661628",
Categories = new List<CreatePaymentCategoryRequest>() {
CreatePaymentCategoryRequest.Meal,
CreatePaymentCategoryRequest.Eco,
},
ImageUrl = "https://...",
ProductUrl = "https://...",
Recurring = new CreatePaymentRecurringRequest() {
Description = "Gym subscription",
Interval = CreatePaymentIntervalRequest.DotDotDotDays,
Amount = new CreatePaymentRecurringAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Times = 1,
StartDate = "2024-12-12",
},
},
},
BillingAddress = new CreatePaymentBillingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
ShippingAddress = new CreatePaymentShippingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
Locale = CreatePaymentLocaleRequest.EnUS,
Method = CreatePaymentMethodRequest.Ideal,
Issuer = "ideal_INGBNL2A",
RestrictPaymentMethodsToCountry = "NL",
CaptureMode = CreatePaymentCaptureModeRequest.Manual,
CaptureDelay = "8 hours",
ApplicationFee = new CreatePaymentApplicationFeeRequest() {
Amount = new CreatePaymentApplicationFeeAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Description = "10",
},
Routing = new List<CreatePaymentRoutingRequest>() {
new CreatePaymentRoutingRequest() {
Amount = new CreatePaymentRoutingAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Destination = new CreatePaymentDestinationRequest() {
Type = CreatePaymentRoutingTypeRequest.Organization,
OrganizationId = "org_1234567",
},
ReleaseDate = "2024-12-12",
Links = new CreatePaymentLinksRequest() {
Self = new CreatePaymentSelfRequest() {
Href = "https://...",
Type = "application/hal+json",
},
Payment = new CreatePaymentPaymentRequest() {
Href = "https://...",
Type = "application/hal+json",
},
},
},
},
MandateId = "mdt_5B8cwPMGnU",
CustomerId = "cst_5B8cwPMGnU",
ProfileId = "pfl_5B8cwPMGnU",
DueDate = "2025-01-01",
Testmode = false,
}
);
// handle response
Available methods
- List - List balances
- Get - Get balance
- GetPrimary - Get primary balance
- GetReport - Get balance report
- ListTransactions - List balance transactions
- List - List capabilities
- Create - Create client link
- Create - Create customer
- List - List customers
- Get - Get customer
- Update - Update customer
- Delete - Delete customer
- CreatePayment - Create customer payment
- ListPayments - List customer payments
- Get - Get organization
- GetCurrent - Get current organization
- GetPartner - Get partner status
- Create - Create payment link
- List - List payment links
- Get - Get payment link
- Update - Update payment link
- Delete - Delete payment link
- ListPayments - Get payment link payments
- Create - Create payment
- List - List payments
- Get - Get payment
- Update - Update payment
- Cancel - Cancel payment
- ReleaseAuthorization - Release payment authorization
- Create - Create profile
- List - List profiles
- Get - Get profile
- Update - Update profile
- Delete - Delete profile
- GetCurrent - Get current profile
- Create - Create payment refund
- List - List payment refunds
- Get - Get payment refund
- Cancel - Cancel payment refund
- All - List all refunds
- Create - Create sales invoice
- List - List sales invoices
- Get - Get sales invoice
- Update - Update sales invoice
- Delete - Delete sales invoice
- List - List settlements
- Get - Get settlement
- GetOpen - Get open settlement
- GetNext - Get next settlement
- ListPayments - List settlement payments
- ListCaptures - List settlement captures
- ListRefunds - List settlement refunds
- ListChargebacks - List settlement chargebacks
- Create - Create subscription
- List - List customer subscriptions
- Get - Get subscription
- Update - Update subscription
- Cancel - Cancel subscription
- All - List all subscriptions
- ListPayments - List subscription payments
- RequestApplePaySession - Request Apple Pay payment session
- Get - Get a Webhook Event
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply pass a RetryConfig
to the call:
using Mollie;
using Mollie.Models.Components;
using Mollie.Models.Requests;
using System.Collections.Generic;
var sdk = new Client(security: new Security() {
ApiKey = "<YOUR_BEARER_TOKEN_HERE>",
});
var res = await sdk.Payments.CreateAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
include: CreatePaymentInclude.DetailsQrCode,
requestBody: new CreatePaymentRequestBody() {
Description = "Chess Board",
Amount = new CreatePaymentAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
RedirectUrl = "https://example.org/redirect",
CancelUrl = "https://example.org/cancel",
WebhookUrl = "https://example.org/webhooks",
Lines = new List<CreatePaymentLineRequest>() {
new CreatePaymentLineRequest() {
Description = "LEGO 4440 Forest Police Station",
Quantity = 1,
QuantityUnit = "pcs",
UnitPrice = new CreatePaymentUnitPriceRequest() {
Currency = "EUR",
Value = "10.00",
},
DiscountAmount = new CreatePaymentDiscountAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
TotalAmount = new CreatePaymentTotalAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
VatRate = "21.00",
VatAmount = new CreatePaymentVatAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Sku = "9780241661628",
Categories = new List<CreatePaymentCategoryRequest>() {
CreatePaymentCategoryRequest.Meal,
CreatePaymentCategoryRequest.Eco,
},
ImageUrl = "https://...",
ProductUrl = "https://...",
Recurring = new CreatePaymentRecurringRequest() {
Description = "Gym subscription",
Interval = CreatePaymentIntervalRequest.DotDotDotDays,
Amount = new CreatePaymentRecurringAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Times = 1,
StartDate = "2024-12-12",
},
},
},
BillingAddress = new CreatePaymentBillingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
ShippingAddress = new CreatePaymentShippingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
Locale = CreatePaymentLocaleRequest.EnUS,
Method = CreatePaymentMethodRequest.Ideal,
Issuer = "ideal_INGBNL2A",
RestrictPaymentMethodsToCountry = "NL",
CaptureMode = CreatePaymentCaptureModeRequest.Manual,
CaptureDelay = "8 hours",
ApplicationFee = new CreatePaymentApplicationFeeRequest() {
Amount = new CreatePaymentApplicationFeeAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Description = "10",
},
Routing = new List<CreatePaymentRoutingRequest>() {
new CreatePaymentRoutingRequest() {
Amount = new CreatePaymentRoutingAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Destination = new CreatePaymentDestinationRequest() {
Type = CreatePaymentRoutingTypeRequest.Organization,
OrganizationId = "org_1234567",
},
ReleaseDate = "2024-12-12",
Links = new CreatePaymentLinksRequest() {
Self = new CreatePaymentSelfRequest() {
Href = "https://...",
Type = "application/hal+json",
},
Payment = new CreatePaymentPaymentRequest() {
Href = "https://...",
Type = "application/hal+json",
},
},
},
},
MandateId = "mdt_5B8cwPMGnU",
CustomerId = "cst_5B8cwPMGnU",
ProfileId = "pfl_5B8cwPMGnU",
DueDate = "2025-01-01",
Testmode = false,
}
);
// handle response
If you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig
optional parameter when intitializing the SDK:
using Mollie;
using Mollie.Models.Components;
using Mollie.Models.Requests;
using System.Collections.Generic;
var sdk = new Client(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
security: new Security() {
ApiKey = "<YOUR_BEARER_TOKEN_HERE>",
}
);
var res = await sdk.Payments.CreateAsync(
include: CreatePaymentInclude.DetailsQrCode,
requestBody: new CreatePaymentRequestBody() {
Description = "Chess Board",
Amount = new CreatePaymentAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
RedirectUrl = "https://example.org/redirect",
CancelUrl = "https://example.org/cancel",
WebhookUrl = "https://example.org/webhooks",
Lines = new List<CreatePaymentLineRequest>() {
new CreatePaymentLineRequest() {
Description = "LEGO 4440 Forest Police Station",
Quantity = 1,
QuantityUnit = "pcs",
UnitPrice = new CreatePaymentUnitPriceRequest() {
Currency = "EUR",
Value = "10.00",
},
DiscountAmount = new CreatePaymentDiscountAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
TotalAmount = new CreatePaymentTotalAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
VatRate = "21.00",
VatAmount = new CreatePaymentVatAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Sku = "9780241661628",
Categories = new List<CreatePaymentCategoryRequest>() {
CreatePaymentCategoryRequest.Meal,
CreatePaymentCategoryRequest.Eco,
},
ImageUrl = "https://...",
ProductUrl = "https://...",
Recurring = new CreatePaymentRecurringRequest() {
Description = "Gym subscription",
Interval = CreatePaymentIntervalRequest.DotDotDotDays,
Amount = new CreatePaymentRecurringAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Times = 1,
StartDate = "2024-12-12",
},
},
},
BillingAddress = new CreatePaymentBillingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
ShippingAddress = new CreatePaymentShippingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
Locale = CreatePaymentLocaleRequest.EnUS,
Method = CreatePaymentMethodRequest.Ideal,
Issuer = "ideal_INGBNL2A",
RestrictPaymentMethodsToCountry = "NL",
CaptureMode = CreatePaymentCaptureModeRequest.Manual,
CaptureDelay = "8 hours",
ApplicationFee = new CreatePaymentApplicationFeeRequest() {
Amount = new CreatePaymentApplicationFeeAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Description = "10",
},
Routing = new List<CreatePaymentRoutingRequest>() {
new CreatePaymentRoutingRequest() {
Amount = new CreatePaymentRoutingAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Destination = new CreatePaymentDestinationRequest() {
Type = CreatePaymentRoutingTypeRequest.Organization,
OrganizationId = "org_1234567",
},
ReleaseDate = "2024-12-12",
Links = new CreatePaymentLinksRequest() {
Self = new CreatePaymentSelfRequest() {
Href = "https://...",
Type = "application/hal+json",
},
Payment = new CreatePaymentPaymentRequest() {
Href = "https://...",
Type = "application/hal+json",
},
},
},
},
MandateId = "mdt_5B8cwPMGnU",
CustomerId = "cst_5B8cwPMGnU",
ProfileId = "pfl_5B8cwPMGnU",
DueDate = "2025-01-01",
Testmode = false,
}
);
// handle response
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default, an API error will raise a Mollie.Models.Errors.APIException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | The error message |
Request |
HttpRequestMessage | The HTTP request |
Response |
HttpResponseMessage | The HTTP response |
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the CreateAsync
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
Mollie.Models.Errors.CreatePaymentUnprocessableEntityHalJSONException | 422 | application/hal+json |
Mollie.Models.Errors.CreatePaymentServiceUnavailableHalJSONException | 503 | application/hal+json |
Mollie.Models.Errors.APIException | 4XX, 5XX | */* |
using Mollie;
using Mollie.Models.Components;
using Mollie.Models.Errors;
using Mollie.Models.Requests;
using System.Collections.Generic;
var sdk = new Client(security: new Security() {
ApiKey = "<YOUR_BEARER_TOKEN_HERE>",
});
try
{
var res = await sdk.Payments.CreateAsync(
include: CreatePaymentInclude.DetailsQrCode,
requestBody: new CreatePaymentRequestBody() {
Description = "Chess Board",
Amount = new CreatePaymentAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
RedirectUrl = "https://example.org/redirect",
CancelUrl = "https://example.org/cancel",
WebhookUrl = "https://example.org/webhooks",
Lines = new List<CreatePaymentLineRequest>() {
new CreatePaymentLineRequest() {
Description = "LEGO 4440 Forest Police Station",
Quantity = 1,
QuantityUnit = "pcs",
UnitPrice = new CreatePaymentUnitPriceRequest() {
Currency = "EUR",
Value = "10.00",
},
DiscountAmount = new CreatePaymentDiscountAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
TotalAmount = new CreatePaymentTotalAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
VatRate = "21.00",
VatAmount = new CreatePaymentVatAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Sku = "9780241661628",
Categories = new List<CreatePaymentCategoryRequest>() {
CreatePaymentCategoryRequest.Meal,
CreatePaymentCategoryRequest.Eco,
},
ImageUrl = "https://...",
ProductUrl = "https://...",
Recurring = new CreatePaymentRecurringRequest() {
Description = "Gym subscription",
Interval = CreatePaymentIntervalRequest.DotDotDotDays,
Amount = new CreatePaymentRecurringAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Times = 1,
StartDate = "2024-12-12",
},
},
},
BillingAddress = new CreatePaymentBillingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
ShippingAddress = new CreatePaymentShippingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
Locale = CreatePaymentLocaleRequest.EnUS,
Method = CreatePaymentMethodRequest.Ideal,
Issuer = "ideal_INGBNL2A",
RestrictPaymentMethodsToCountry = "NL",
CaptureMode = CreatePaymentCaptureModeRequest.Manual,
CaptureDelay = "8 hours",
ApplicationFee = new CreatePaymentApplicationFeeRequest() {
Amount = new CreatePaymentApplicationFeeAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Description = "10",
},
Routing = new List<CreatePaymentRoutingRequest>() {
new CreatePaymentRoutingRequest() {
Amount = new CreatePaymentRoutingAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Destination = new CreatePaymentDestinationRequest() {
Type = CreatePaymentRoutingTypeRequest.Organization,
OrganizationId = "org_1234567",
},
ReleaseDate = "2024-12-12",
Links = new CreatePaymentLinksRequest() {
Self = new CreatePaymentSelfRequest() {
Href = "https://...",
Type = "application/hal+json",
},
Payment = new CreatePaymentPaymentRequest() {
Href = "https://...",
Type = "application/hal+json",
},
},
},
},
MandateId = "mdt_5B8cwPMGnU",
CustomerId = "cst_5B8cwPMGnU",
ProfileId = "pfl_5B8cwPMGnU",
DueDate = "2025-01-01",
Testmode = false,
}
);
// handle response
}
catch (Exception ex)
{
if (ex is CreatePaymentUnprocessableEntityHalJSONException)
{
// Handle exception data
throw;
}
else if (ex is CreatePaymentServiceUnavailableHalJSONException)
{
// Handle exception data
throw;
}
else if (ex is Mollie.Models.Errors.APIException)
{
// Handle default exception
throw;
}
}
The default server can be overridden globally by passing a URL to the serverUrl: string
optional parameter when initializing the SDK client instance. For example:
using Mollie;
using Mollie.Models.Components;
using Mollie.Models.Requests;
using System.Collections.Generic;
var sdk = new Client(
serverUrl: "https://api.mollie.com/v2",
security: new Security() {
ApiKey = "<YOUR_BEARER_TOKEN_HERE>",
}
);
var res = await sdk.Payments.CreateAsync(
include: CreatePaymentInclude.DetailsQrCode,
requestBody: new CreatePaymentRequestBody() {
Description = "Chess Board",
Amount = new CreatePaymentAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
RedirectUrl = "https://example.org/redirect",
CancelUrl = "https://example.org/cancel",
WebhookUrl = "https://example.org/webhooks",
Lines = new List<CreatePaymentLineRequest>() {
new CreatePaymentLineRequest() {
Description = "LEGO 4440 Forest Police Station",
Quantity = 1,
QuantityUnit = "pcs",
UnitPrice = new CreatePaymentUnitPriceRequest() {
Currency = "EUR",
Value = "10.00",
},
DiscountAmount = new CreatePaymentDiscountAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
TotalAmount = new CreatePaymentTotalAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
VatRate = "21.00",
VatAmount = new CreatePaymentVatAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Sku = "9780241661628",
Categories = new List<CreatePaymentCategoryRequest>() {
CreatePaymentCategoryRequest.Meal,
CreatePaymentCategoryRequest.Eco,
},
ImageUrl = "https://...",
ProductUrl = "https://...",
Recurring = new CreatePaymentRecurringRequest() {
Description = "Gym subscription",
Interval = CreatePaymentIntervalRequest.DotDotDotDays,
Amount = new CreatePaymentRecurringAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Times = 1,
StartDate = "2024-12-12",
},
},
},
BillingAddress = new CreatePaymentBillingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
ShippingAddress = new CreatePaymentShippingAddressRequest() {
Title = "Mr.",
GivenName = "Piet",
FamilyName = "Mondriaan",
OrganizationName = "Mollie B.V.",
StreetAndNumber = "Keizersgracht 126",
StreetAdditional = "Apt. 1",
PostalCode = "1234AB",
Email = "piet@example.org",
Phone = "31208202070",
City = "Amsterdam",
Region = "Noord-Holland",
Country = "NL",
},
Locale = CreatePaymentLocaleRequest.EnUS,
Method = CreatePaymentMethodRequest.Ideal,
Issuer = "ideal_INGBNL2A",
RestrictPaymentMethodsToCountry = "NL",
CaptureMode = CreatePaymentCaptureModeRequest.Manual,
CaptureDelay = "8 hours",
ApplicationFee = new CreatePaymentApplicationFeeRequest() {
Amount = new CreatePaymentApplicationFeeAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Description = "10",
},
Routing = new List<CreatePaymentRoutingRequest>() {
new CreatePaymentRoutingRequest() {
Amount = new CreatePaymentRoutingAmountRequest() {
Currency = "EUR",
Value = "10.00",
},
Destination = new CreatePaymentDestinationRequest() {
Type = CreatePaymentRoutingTypeRequest.Organization,
OrganizationId = "org_1234567",
},
ReleaseDate = "2024-12-12",
Links = new CreatePaymentLinksRequest() {
Self = new CreatePaymentSelfRequest() {
Href = "https://...",
Type = "application/hal+json",
},
Payment = new CreatePaymentPaymentRequest() {
Href = "https://...",
Type = "application/hal+json",
},
},
},
},
MandateId = "mdt_5B8cwPMGnU",
CustomerId = "cst_5B8cwPMGnU",
ProfileId = "pfl_5B8cwPMGnU",
DueDate = "2025-01-01",
Testmode = false,
}
);
// handle response
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.