#Zan
1 messages ยท Page 1 of 1 (latest)
Hi, taking a look here. I'm not as familiar with Flutter but will ask someone if I get stuck
thanks
With C# we creating session but with mobile app we doing payment intent
just an fyi
I'm getting some help here
๐ Hopping in here! Which flutter library are you using?
hi
let me check
I am not a flutter developer so don't know much about this code. but i can see direct API calls to stripe API
and this is the body of paymentIntentAPi Map<String, dynamic> body = {
'amount': userPayingAmount.toString(),
'currency': currency,
'payment_method_types[]': 'card',
"application_fee_amount": adminFeesAmount.toString(),
"transfer_data[destination]": vendorStripeAccId,
"receipt_email": checkoutController.emailFieldController.text
.trim()
.toLowerCase()
.toString(),
};
this is the initPaymentSheet function -
Future<void> initPaymentSheet({
context,
userPayingAmount,
adminFeesAmount,
}) async {
try {
isLoading(true);
// var price = double.parse(bookingPrice);
var price = double.parse(checkoutController.totalPrice.toString());
log("booking UserName is : $bookingUserName");
log("price passing is : $price");
log("price symbol is : $payCurrencySymbol");
paymentIntentData = await createPaymentIntent(
userPayingAmount: userPayingAmount,
adminFeesAmount: adminFeesAmount,
currency: payCurrencySymbol == "\$" ? "aud" : "inr",
);
log('paymentIntentData: $paymentIntentData');
// var adminCharges =
// (int.parse(cardScreenController.bookingPrice) / 100) * 10;
// Stripe
// var stripeAccId = Stripe.stripeAccountId;
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
//client_secret
paymentIntentClientSecret: paymentIntentData!['client_secret'],
merchantDisplayName: UserDetails.userName == ''
? bookingUserName
: UserDetails.userName,
customerId: null,
customerEphemeralKeySecret: paymentIntentData!['ephemeralKey'],
customFlow: true,
style: ThemeMode.light,
testEnv: true,
applePay: true,
googlePay: true,
),
);
await Stripe.instance.presentPaymentSheet();
await Stripe.instance.confirmPaymentSheetPayment();
log('responseFinal1234');
await checkoutController.checkOutSubmitFunction();
// await getPaymentIdFunction(
// paymentIntentData!['id'],
// paymentIntentData!['client_secret'],
// );
// isLoading(false);//todo - Remove isLoading
isProceedToPayButton(true);
}
If you're not a flutter developer why are you using flutter?
Gotcha - so at a minimum, you need to be changing whatever backend code you have that is creating the PaymentIntent and have it also create a Customer and pass in that Customer ID when the PAymentIntent is being created
please let me know what needs to be added in payment intent in order to create customer for each payment ( instead of coming up as guest).
You need to separately make another API call to stripe to create a Customer and then pass the already created Customer ID when you create the PaymentIntent
THere is no parameter for payment intent creation that will automatically create a Customer for you
ok
in C# there is an parameter "createcustomeralways"
that creates for us
and works fine on website
is there such parameter that i could use in flutter
As far as I know that's not something we support in any of our official libraries (that's why I asked which library you were using)
I need to head out, but if you have any questions orakaro is around to help
๐