#Zan

1 messages ยท Page 1 of 1 (latest)

strange mistBOT
elfin iris
#

Hi, taking a look here. I'm not as familiar with Flutter but will ask someone if I get stuck

slate sail
#

thanks

#

With C# we creating session but with mobile app we doing payment intent

#

just an fyi

elfin iris
#

I'm getting some help here

tired glen
#

๐Ÿ‘‹ Hopping in here! Which flutter library are you using?

slate sail
#

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);
}
tired glen
#

If you're not a flutter developer why are you using flutter?

slate sail
#

we hired someone for mobile developement

#

and they have designed this for us

tired glen
#

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

slate sail
#

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).

tired glen
#

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

slate sail
#

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

tired glen
#

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

desert summit
#

๐Ÿ‘‹