device_session_id 1.0.6 copy "device_session_id: ^1.0.6" to clipboard
device_session_id: ^1.0.6 copied to clipboard

This is a package that uses the Openpay iOS and Openpay Android libraries to get the Device Session ID for the anti-fraud system.

example/lib/main.dart

import 'package:device_session_id/device_session_id.dart';
import 'package:flutter/material.dart';
import 'dart:async';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _deviceID = '';
  @override
  void initState() {
    super.initState();
    initDeviceSession();
  }

  Future<void> initDeviceSession() async {
    String deviceID;
    const String merchantID =
        '<<MERCHANT_ID>>'; // REPLACE THIS WITH YOUR MERCHANT ID
    const String apiKey = '<<API_KEY>>'; // REPLACE THIS WITH YOUR API KEY
    const bool productionMode =
        true; // REPLACE THIS IF YOU ARE NOT ON PRODUCTION MODE
    try {
      deviceID = await DeviceSessionId.getDeviceID(
              merchantID, apiKey, productionMode) ??
          'Error getting the device session id';
    } catch (e) {
      deviceID = 'Error getting the device session id';
    }

    setState(() {
      // THIS IS WHERE THE ID IS STORED
      _deviceID = deviceID;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('OpenPay device session id'),
        ),
        body: Center(
          child: Text('ID : $_deviceID\n'), // THIS IS WHERE THE ID IS SHOWED
        ),
      ),
    );
  }
}
10
likes
160
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

This is a package that uses the Openpay iOS and Openpay Android libraries to get the Device Session ID for the anti-fraud system.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on device_session_id

Packages that implement device_session_id