#aamaulana10 - flutter

1 messages ยท Page 1 of 1 (latest)

winged hearth
#

Hi ๐Ÿ‘‹

dire oriole
#

Hi

winged hearth
#

Are you confirming the payment server-side or client side?

dire oriole
#

client side, i follow react front end code.
its like

if (payment_intent.payment_client_secret) {
const { error } = await stripe.confirmCardPayment(
payment_intent.payment_client_secret,
);
if (error) stripe_error = error;
} else {
const { error } = await stripe.confirmCardSetup(
payment_intent.setup_client_secret,
);
if (error) stripe_error = error;
}

then i try to implement that code to Flutter dart code like

if (paymentIntent.paymentClientSecret != null) {
await Stripe.instance.confirmPayment(
paymentIntent.paymentClientSecret,
PaymentMethodParams.cardFromMethodId(
paymentMethodData: PaymentMethodDataCardFromMethod(
paymentMethodId: selectedPaymentMethod.id
)
),
);

  } else {
    print("here");

    await Stripe.instance.confirmSetupIntent(
      paymentIntent.setupClientSecret,
      PaymentMethodParams.cardFromMethodId(
          paymentMethodData: PaymentMethodDataCardFromMethod(
              paymentMethodId: selectedPaymentMethod.id
          ),
        options: PaymentMethodOptions(
          setupFutureUsage: PaymentIntentsFutureUsage.OnSession
        )
      ),
    );

but i still got error card details not complete on iOS, but works perfectly o Android

#

so i wondering how to payment with saved card from backend

winged hearth
#

and provide the Payment Method ID in the payment_method parameter

dire oriole
#

how to do that from frontend ?

#

like Flutter dart

winged hearth
#

I am not familiar with flutter. You could send a response back to your server with the payment method the user selected and then do the confirmation on the server.