in_app_payment

Last updated:

0 purchases

in_app_payment Image
in_app_payment Images
Add to Cart

Description:

in app payment

A package to add google pay and apple pay to your Flutter application.
It is the payment package for the stage 5 task of HNGx internship.
Platform Support #



Android
Google Pay




iOS:
Apple Pay



Features #
This package helps to integrate Google pay and Apple pay into your app.
Getting started #
Usage #


Import the package into your project.
To start using this plugin, add in_app_payment as a dependency in your pubspec.yaml file:
dependencies:
in_app_payment: ^0.0.2
copied to clipboard


Initialize HNGPay:
final pay = HNGPay();
copied to clipboard


For Android, invoke the googlePay function in place of your 'pay' button in your app and pass the amount to be paid as argument.
pay.googlePay(context, amountToPay: "24", userID: '23')
copied to clipboard


For IOS, invoke the applePay function in place of your 'pay' button in your app and pass the amount to be paid as argument.
pay.applePay(context, amountToPay: "24", userID: '23'),
copied to clipboard


Example #
This snippet assumes the existence a payment configuration
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> {

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: Container(
child: pay.googlePay(context, amountToPay: "24", userID: '23'), //for android implementaion
),
),
);
}
}

copied to clipboard
Authors #

Rayhan Awojobi
Ridwan Lawal
Zaccheus Oluwole

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.