final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
Default base URL is https://api.m8ty.eu/api/v1; override with basePathOverride only for non-prod environments.
Catch DioException and handle status code plus response body from e.response.
API Surface
PaymentsApi
Method
Description
createPayment
Initiate a payment
editByPaymentId
Edit existing payment
getByPaymentId
Get details of a payment
fetchAllPayments
Get all payments
cancelByPaymentId
Cancellation of a payment
approveByPaymentId
Approve payment for the given id
statusByPaymentId
Get status of a payment
validatePayment
Validates if a payment can be created
createPaymentAuthorization
Initiate authorization request
confirmPaymentAuthorization
Confirm the authorization of payment
BeneficiaryApi
Method
Description
beneficiaryAutocompletion
Search for beneficiaries
InstantPaymentsApi
Method
Description
getStatus
Get status of instant payment
getAllInstantPaymentNotifications
Retrieve instant payment notifications
markNotificationsAsRead
Mark instant payment notifications as read
QrBillApi
Method
Description
generateQrBill
Generate QR bill payment for account
scanQrBill
Scan QR bill document and return payment data
SettingsApi
Method
Description
getPaymentsSettings
Retrieve payments user settings
updatePaymentsSettings
Update payments user settings
How to perform different tasks
Here some examples how the dart client can be used
Create a simple payment
final paymentModel = ModelHelperPayments().createPaymentDetailed(
executionDate: Date.now(),
accountId: "123",
amount: 100,
purpose: "Care for me",
counterpartIban: "CH9300762011623852957",
counterpartName: "Migros",
);
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPaymentsApi();
await api.createPayment(paymentModel: paymentModel);
Create a standing order
final paymentModel = ModelHelperPayments().createPaymentDetailed(
executionDate: Date.now(),
accountId: "123",
amount: 100,
purpose: "Care for me",
counterpartIban: "CH9300762011623852957",
counterpartName: "Migros",
standingOrderFrequency: FrequencyEnumModel.QUARTERLY,
standingOrderEndDate: DateTime.now().add(Duration(year: 2)).toDate(),
);
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPaymentsApi();
await api.createPayment(paymentModel: paymentModel);
Validate a payment before creation
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPaymentsApi();
try {
final response = await api.validatePayment(
paymentModel: paymentModel,
);
print('Validation: ${response.data}');
} on DioException catch (e) {
throw Exception(
'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}',
);
}
Search for beneficiaries (autocompletion)
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBeneficiaryApi();
final response = await api.beneficiaryAutocompletion(
beneficiaryAutocompleteRequestModel: BeneficiaryAutocompleteRequestModel((b) {
// set search criteria
}),
);
Scan a QR bill
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getQrBillApi();
final response = await api.scanQrBill(
// provide QR bill document
);