Skip to content

m8ty_client_pis

m8ty_client_pis solves this with typed APIs for payment creation, validation, authorization, beneficiaries, QR bills, instant-payment notifications, and settings, supporting clearer and safer payment journeys.

Payment information services cover all the aspects of payments, beneficiaries, QR bills, instant payments, and payment settings.

Check the documentation of the m8ty_client_pis library to get an idea about the available models and their properties.

import 'package:dio/dio.dart';
import 'package:m8ty_client_pis/m8ty_client_pis.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
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.
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
Method Description
beneficiaryAutocompletion Search for beneficiaries
Method Description
getStatus Get status of instant payment
getAllInstantPaymentNotifications Retrieve instant payment notifications
markNotificationsAsRead Mark instant payment notifications as read
Method Description
generateQrBill Generate QR bill payment for account
scanQrBill Scan QR bill document and return payment data
Method Description
getPaymentsSettings Retrieve payments user settings
updatePaymentsSettings Update payments user settings

Here some examples how the dart client can be used

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);
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);
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}',
);
}
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getBeneficiaryApi();
final response = await api.beneficiaryAutocompletion(
beneficiaryAutocompleteRequestModel: BeneficiaryAutocompleteRequestModel((b) {
// set search criteria
}),
);
final client = M8tyClientPis();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getQrBillApi();
final response = await api.scanQrBill(
// provide QR bill document
);