in_app_payment 0.0.2
in_app_payment: ^0.0.2 copied to clipboard
In app payment package for the stage 6 task of the HNGx Internship. This package would enable flutter developers make payments through google pay and apple pay in their application.
import 'package:flutter/material.dart';
import 'package:in_app_payment/in_app_payment.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
///initializing payment package
final pay = HNGPay();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text("Payment test"),
),
body: Center(
child: SizedBox(
child: pay.googlePay(context, amountToPay: "24", userID: '23'),
/// accepting the amount and user id
),
),
);
}
}