ypay_api 1.0.2-pre.2 copy "ypay_api: ^1.0.2-pre.2" to clipboard
ypay_api: ^1.0.2-pre.2 copied to clipboard

Easy, cross-platform payment API for online systems.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:ypay_api/ypay.dart';

Future<void> main() async {
  await YPAY.initialize(
    config: YPAYConfig(
      clientId: "196|l1Un2QbfEFEkmV5NQ6DiEYXo4mgG4QzkSH3xFhVT15ab1071",
      title: "YShop",
      languageCode: Language.fr,
      amount: 1000.0,
      currency: Currency.xof,
      contentWidth: 448,
      logo: null,
      showDebug: true,
      showSuccessDialog: true,
    ),
  );
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Color(0xFF5F47FF),
          centerTitle: true,
          title: const Text(
            'YPAY API EXEMPLE',
            style: TextStyle(color: Colors.white),
          ),
        ),
        body: Center(
          child:
          // Column(
          //   mainAxisAlignment: MainAxisAlignment.center,
          //   crossAxisAlignment: CrossAxisAlignment.center,
          //   children: [
          //     Text(
          //       "Outline button",
          //       style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
          //     ),
          //     SizedBox(height: 5),
          //     SizedBox(
          //       width: 200,
          //       child: YPAY.getButton(
          //         onTapMode: OnTapMode.dialog,
          //         btnType: BtnType.outline,
          //         amount: 100.0,
          //         onSuccess: (value) {}, // callback on success
          //         onError: (value) {}, // callback on error
          //       ),
          //     ),
          //     Padding(
          //       padding: const EdgeInsets.symmetric(
          //         vertical: 20,
          //         horizontal: 10,
          //       ),
          //       child: Divider(),
          //     ),
          //     Text(
          //       "filled button",
          //       style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
          //     ),
          //     SizedBox(height: 5),
          //     SizedBox(
          //       width: 200,
          //       child: YPAY.getButton(
          //         onTapMode: OnTapMode.newPage,
          //         btnType: BtnType.filled,
          //         amount: 100.0,
          //         onSuccess: (value) {}, // callback on success
          //         onError: (value) {}, // callback on error
          //       ),
          //     ),
          //     Padding(
          //       padding: const EdgeInsets.symmetric(
          //         vertical: 20,
          //         horizontal: 10,
          //       ),
          //       child: Divider(),
          //     ),
          //     Text(
          //       "Icon button",
          //       style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
          //     ),
          //     SizedBox(height: 5),
          //     SizedBox(
          //       width: 200,
          //       child: YPAY.getButton(
          //         onTapMode: OnTapMode.newPage,
          //         btnType: BtnType.icon,
          //         amount: 100.0,
          //         onSuccess: (value) {
          //           print(value);
          //         }, // callback on success
          //         onError: (value) {
          //           print(value);
          //         }, // callback on error
          //       ),
          //     ),
          //   ],
          // ),
          /// embed the paiement view
          ///
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: YPAY.getWidget(
              amount: 100.0,
              onSuccess: (value) {}, // callback on success
              onError: (value) {}, // callback on error
            ),
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
136
downloads

Publisher

unverified uploader

Weekly Downloads

Easy, cross-platform payment API for online systems.

Homepage

License

unknown (license)

Dependencies

clipboard, flutter, flutter_web_plugins, http, pinput, plugin_platform_interface, url_launcher, url_launcher_platform_interface, web

More

Packages that depend on ypay_api

Packages that implement ypay_api