m8ty_client_paymentscan
Package overview
Section titled “Package overview”m8ty_client_paymentscan solves this with QR-based connection and payment scanning APIs, enabling customers to move payment data into the app quickly and accurately.
Payment scanner client for QR code-based payments. Enables scanning QR codes from web apps and processing payment QR codes.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_paymentscan library.
Import all needed libraries
Section titled “Import all needed libraries”import 'package:dio/dio.dart';import 'package:m8ty_client_paymentscan/m8ty_client_paymentscan.dart';Client Setup
Section titled “Client Setup”final client = M8tyClientPaymentscan();client.setOAuthToken('ApiOAuth2', oauthToken);API Surface
Section titled “API Surface”PaymentScannerApi
Section titled “PaymentScannerApi”| Method | Description |
|---|---|
scanConnect |
Scan QR from webApp to enable Payment Scan QRs |
scanPayment |
Scan Payment QR |
How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Scan connect (pair with web app)
Section titled “Scan connect (pair with web app)”final client = M8tyClientPaymentscan();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPaymentScannerApi();
try { final response = await api.scanConnect( scanConnectRequestModel: ScanConnectRequestModel((b) { // set required fields }), ); print('Connected: ${response.data}');} on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', );}Scan payment QR
Section titled “Scan payment QR”final client = M8tyClientPaymentscan();client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getPaymentScannerApi();
try { final response = await api.scanPayment( // provide scanned QR data ); print('Payment data: ${response.data}');} on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', );}© m8ty GmbH 2023 · m8ty.eu
