#saadalti-qs
1 messages · Page 1 of 1 (latest)
Hello
Im an old stripe user i have many websites working with you
But it is my first time i use on ios
I used website
And android flutter
Now im.using flutter ios
The pop up pay is working on android studio windows
Now i run the same project on mac didn't work
The debug got error in android studio
flutter: null
flutter: Error from Stripe: No payment sheet has been initialized yet
And on xcode the picture below
When i press confirm nothing shown
Any help?
could you share the exact code you're using?
we can try to help but we don't actually officially support Flutter, it's a third party plugin, we only directly support/have training on our native iOS/Android libraries and React Native.
@quiet temple hello again.
Hi
hello. As I mentioned, could you share the exact code you're using?
Ok will get to office and send you the exact code
But i use flutter
It is working on windows
cool! not much we can say without more information so let us know when you have it.
This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
okayu
im here
first of all im using stripe: ^4.7.0
and flutter_stripe: ^2.4.0
void main() async {
WidgetsFlutterBinding.ensureInitialized();
NotificationService().initNotification();
await PushNotificationService().setupInteractedMessage();
Stripe.publishableKey = stripeKey;
await Stripe.instance.applySettings();
await Hive.initFlutter();
runApp(const MyApp());
RemoteMessage? initialMessage =
await FirebaseMessaging.instance.getInitialMessage();
if (initialMessage != null) {
// App received a notification when it was killed
}
}
so you want me to send you code for what ?
when pressing confirm?
Sharing the code relevant to the specific issue you're having would be best.
Again, as @sonic torrent mentioned, we don't have our own SDK for Flutter that we can support, but if its a general API issue produced by the library you're using we might be able to help
Looking at the earlier messages, it sounds like you're having an issue with your environment building/running your Flutter app, which isn't something we'll be able to help with
I suggest reaching out to the Flutter community to get some guidance with that
no sir
on mac it is building and running without any issue
but the issue im facing that stripe is not poping out from bottom
What do you mean, exactly?
i mean
stripe is not poping out from bottom
What do you expect to happen? What does this look like and what makes you expect it?
look
on android when i press confirm order
it pop ups
from bottom
to enter the payment entries
visa cvc etc..
on android/windows
but when i open the project on mac
on android studio too
it wont work
so the issue is on ios
not project or flutter
do you want the payment class?
class Payment {
Map<String, dynamic>? paymentIntentData;
Future<void> makePayment(
{required String amount,
required String currency,
var context,
paytype,
fcmToken,
price}) async {
try {
paymentIntentData = await createPaymentIntent(amount, currency);
print(paymentIntentData!['ephemeralSecret']);
if (paymentIntentData != null) {
// StripePaymentIntenOutput? intent = await StripeAppService.instance
// .createTipPayment(stripePaymentInput);
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
applePay: true,
googlePay: true,
// style: ThemeMode.light,
testEnv: false,
merchantCountryCode: 'US',
merchantDisplayName: 'Prospects',
customerId: paymentIntentData!['customer'],
paymentIntentClientSecret: paymentIntentData!['client_secret'],
setupIntentClientSecret: paymentIntentData!['client_secret'],
customerEphemeralKeySecret: paymentIntentData!['client_secret'],
));
displayPaymentSheet(context, paytype, fcmToken, amount);
}
} catch (e, s) {
print('exception:$e$s');
}
}
displayPaymentSheet(context, paytype, fcmToken, price) async {
try {
await Stripe.instance.presentPaymentSheet();
print('payment success');
//await DatabaseHelper.instance.removeCart();
await HiveDatabase.clearCart();
print( paytype);
SchedulerBinding.instance!.addPostFrameCallback((_) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OnlinePaySuccessScreen(
delivertoaddress: Provider.of<Auth>(context, listen: false)
.usersDefaultAddress.toString(),
paymentType: paytype,
fcmToken: fcmToken,
price: price,
)));
});
} on Exception catch (e) {
if (e is StripeException) {
print("Error from Stripe: ${e.error.localizedMessage}");
} else {
print("Unforeseen error: $e");
}
} catch (e) {
print("exception:$e");
}
}
// Future<Map<String, dynamic>>
createPaymentIntent(String amount, String currency) async {
try {
Map<String, dynamic> body = {
'amount': calculateAmount(amount),
'currency': currency,
'payment_method_types[]': 'card'
};
var response = await http.post(
Uri.parse('https://api.stripe.com/v1/payment_intents'),
body: body,
headers: {
///change the token key here
'Authorization': " Bearer $tokenKey",
'Content-Type': 'application/x-www-form-urlencoded'
});
return jsonDecode(response.body);
} catch (err) {
print('err charging user: ${err.toString()}');
}
}
calculateAmount(String amount) {
if (amount.contains(".")) {
final String number = ((double.parse(amount) * 10) ~/ 1).toString();
final result = double.parse(amount) * 100;
print(' result ${result.round()}');
return result.round().toString();
} else {
final a = (int.parse(amount)) * 100;
return a.toString();
}
}
}
Ok, and which library for flutter are you using?
I'd suggest creating a minimal reproduction of the issue in a public repository and filing an issue with the maintainers of that library to help investigate/resolve
hmmm
Select All, [5/9/2022 6:42 PM]
Runner[6925:39865] flutter: null
2022-05-09 08:42:04.899023-0700 Runner[6925:39865] flutter: 0
2022-05-09 08:42:04.918602-0700 Runner[6925:39865] flutter: Error from Stripe: No payment sheet has been initialized yet
that is the error im facing
It looks like you have initPaymentSheet so i don't know why that might not be working
If you're following a guide provided by the FLutter library, then I'd suggest reaching out to them to ask for clarification on the issue, eg whether it might be related to managing app state etc
it works
just googled it
so the fix is to add in main
merchantIdentifier
Stripe.merchantIdentifier = 'merchant.flutter.stripe.test';
Stripe.urlScheme = 'flutterstripe';
so i would like to ask
merchantIdentifier is ?
what should i put here
instead of merchant.flutter.stripe.test
Hi there! Taking over @sly valley give me a few minutes to get caught up