#aamaulana10 - flutter
1 messages ยท Page 1 of 1 (latest)
Hi
Are you confirming the payment server-side or client side?
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
From the back-end you would just use the Confirm API endpoint: https://stripe.com/docs/api/payment_intents/confirm
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and provide the Payment Method ID in the payment_method parameter
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.