This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(functions.config().firebase); | |
const firestore = admin.firestore(); | |
const settings = { timestampInSnapshots: true }; | |
firestore.settings(settings) | |
const stripe = require('stripe')('YOUR_SECRET_STRIPE_KEY'); | |
exports.createPaymentIntent = functions.https.onCall((data, context) => { | |
return stripe.paymentIntents.create({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StripePayment.paymentRequestWithCardForm(CardFormPaymentRequest()) | |
.then((paymentMethod) { | |
setState(() { | |
_isLoading = true; | |
}); | |
_paymentMethod = paymentMethod; | |
getAmount(); | |
var result = INTENT.call(<String, dynamic>{'amount': _rem}).then((re) { | |
_currentSecret = re.data["client_secret"]; | |
confirmDialog(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StripePayment.paymentRequestWithCardForm(CardFormPaymentRequest()) | |
.then((paymentMethod) { | |
double amount=100*100.0; // multipliying with 100 to change $ to cents | |
INTENT.call(<String, dynamic>{'amount': amount,'currency':'usd'}).then((response) { | |
confirmDialog(response.data["client_secret"],paymentMethod); //function for confirmation for payment | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
confirmDialog(String clientSecret,PaymentMethod paymentMethod) { | |
var confirm = AlertDialog( | |
title: Text("Confirm Payement"), | |
content: Container( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.center, | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
Text( | |
"Make Payment", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
confirmPayment(String sec, PaymentMethod paymentMethod) { | |
StripePayment.confirmPaymentIntent( | |
PaymentIntent(clientSecret: sec, paymentMethodId: paymentMethod.id), | |
).then((val) { | |
addPaymentDetailsToFirestore(); //Function to add Payment details to firestore | |
final snackBar = SnackBar(content: Text('Payment Successfull'),); | |
Scaffold.of(context).showSnackBar(snackBar); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void addPaymentDetailsToFirestore() { | |
widget._db.collection("Users").document(widget.user.email).collection("Payments").add({ | |
"currency":"USD", | |
'amount':'100', | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "package:googleapis_auth/auth_io.dart"; | |
import 'package:googleapis/calendar/v3.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const _scopes = const [CalendarApi.CalendarScope]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _credentials; | |
if (Platform.isAndroid) { | |
_credentials = new ClientId( | |
"YOUR_CLIENT_ID_FOR_ANDROID_APP_RETRIEVED_FROM_Google_Console_Project_EARLIER", | |
""); | |
} else if (Platform.isIOS) { | |
_credentials = new ClientId( | |
"YOUR_CLIENT_ID_FOR_IOS_APP_RETRIEVED_FROM_Google_Console_Project_EARLIER", | |
""); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventDateTime start = new EventDateTime(); | |
start.dateTime = startTime; | |
start.timeZone = "GMT+05:00"; | |
event.start = start; | |
EventDateTime end = new EventDateTime(); | |
end.timeZone = "GMT+05:00"; | |
end.dateTime = endTime; | |
event.end = end; |
OlderNewer