mirror of
https://github.com/SoPat712/RUSwipeShare.git
synced 2025-08-21 10:58:47 -04:00
stripe
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.ruswipeshare">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application
|
||||
|
||||
android:label="ruswipeshare"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
@@ -25,6 +27,7 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package com.example.ruswipeshare
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.android.FlutterFragmentActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
|
||||
class MainActivity: FlutterFragmentActivity() {
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<style name="NormalTheme" parent="Theme.MaterialComponents">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<style name="LaunchTheme" parent="Theme.MaterialComponents">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
|
||||
import 'firebase_options.dart';
|
||||
import 'auth_gate.dart';
|
||||
@@ -7,8 +8,9 @@ import 'auth_gate.dart';
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||
|
||||
runApp(const MyApp());
|
||||
Stripe.publishableKey = "pk_test_51MfY7PFVdcWv896FKvDhgKabYeDq4AnoFcWxCAg4hquj6TBAsN0kznXPVyKA7M1pMq5PsieGQwsx6QY5ld5ZQzJ500rVCMPPXp";
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:firebase_auth/firebase_auth.dart' show ActionCodeSettings, FirebaseAuth, FirebaseAuthException, User;
|
||||
import 'package:flutter/cupertino.dart' hide Title;
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -11,6 +13,8 @@ import 'package:flutter/material.dart' hide Title;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_credit_card/credit_card_brand.dart';
|
||||
import 'package:flutter_credit_card/flutter_credit_card.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutterfire_ui/auth.dart';
|
||||
import 'package:flutterfire_ui/src/auth/widgets/internal/loading_button.dart';
|
||||
|
||||
@@ -257,7 +261,43 @@ class ProfileScreenCustom extends MultiProviderScreen {
|
||||
style: ButtonStyle(
|
||||
foregroundColor: MaterialStateProperty.all<Color>(Colors.red),
|
||||
),
|
||||
onPressed: () {Navigator.push(context, MaterialPageRoute(builder: (context)=> CreditView())); },
|
||||
onPressed: () async {
|
||||
|
||||
|
||||
try {
|
||||
// 1. create payment intent on the server
|
||||
|
||||
var Ddata = await http.get(Uri.parse('http://172.20.10.2:5000/payment-sheet?price=50'));
|
||||
|
||||
var data = jsonDecode(Ddata.body);
|
||||
print("wtf");
|
||||
|
||||
// 2. initialize the payment sheet
|
||||
await Stripe.instance.initPaymentSheet(
|
||||
paymentSheetParameters: SetupPaymentSheetParameters(
|
||||
// Enable custom flow
|
||||
customFlow: true,
|
||||
// Main params
|
||||
merchantDisplayName: 'RU SwipeTrade',
|
||||
paymentIntentClientSecret: data['paymentIntent'],
|
||||
// Customer keys
|
||||
customerEphemeralKeySecret: data['ephemeralKey'],
|
||||
customerId: data['customer'],
|
||||
// Extra options
|
||||
style: ThemeMode.dark,
|
||||
),
|
||||
);
|
||||
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Error: $e')),
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
await Stripe.instance.presentPaymentSheet();
|
||||
|
||||
},
|
||||
child: Text('Setup Seller'),
|
||||
),
|
||||
Align(
|
||||
|
@@ -390,7 +390,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.10.2+1"
|
||||
http:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
|
||||
|
@@ -43,6 +43,7 @@ dependencies:
|
||||
geolocator: ^9.0.2
|
||||
flutter_credit_card: any
|
||||
flutter_stripe: any
|
||||
http: any
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user