#nck-flutter
1 messages ยท Page 1 of 1 (latest)
Hey! Share as much context as possible
FYI, Flutter is a third-party library but will do my best to assist!
Thank you ๐
So, Apple Pay works perfectly fine. But not Google Pay. This is what my payment configuration file looks like for Google Pay:
{
"provider": "google_pay",
"data": {
"environment": "TEST",
"apiVersion": 2,
"apiVersionMinor": 0,
"allowedPaymentMethods": [
{
"type": "CARD",
"tokenizationSpecification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "stripe",
"stripe:version": "2020-08-27",
"stripe:publishableKey": "pk_test_xxx"
}
},
"parameters": {
"allowedAuthMethods": ["PAN_ONLY", "CRYPTOGRAM_3DS"],
"allowedCardNetworks": ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "MIR", "VISA"],
"billingAddressRequired": true,
"billingAddressParameters": {
"format": "FULL",
"phoneNumberRequired": false
}
}
}
],
"merchantInfo": {
"merchantId": "xxx",
"merchantName": "xxx"
},
"transactionInfo": {
"countryCode": "DE",
"currencyCode": "EUR"
}
}
}
And the GooglePayButton of the pay package has a callback function, which returns the results for a successful token creation. So I am treating its result, I am naming it paymentSheetResult, like the following:
final token =
paymentSheetResult['paymentMethodData']['tokenizationData']['token'];
final tokenJson = Map.castFrom(json.decode(token));
PaymentMethodParams params = PaymentMethodParams.cardFromToken(
token: tokenJson['id'],
setupFutureUsage: PaymentIntentsFutureUsage.OffSession,
);
PaymentMethod paymentMethod = await Stripe.instance.createPaymentMethod(
params,
);
PaymentMethod and PaymentMethodParams are from the flutter_stripe package.
I'd generally recommend against using createPaymentMethod directly
But can you share the ID (req_xxx) of the failing API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
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.
interestingly there is nothing ๐ค
What else would I do?
Correct. We are saving payment methods for future and off-session usage. The result of the payment method creation is being sent to our API to attach a saved payment method to a customers profile that he later can choose from.
payment method creation is being sent to our API to attach a saved payment method to a customers profile
You shouldn't really do that directly either
What you want is: https://stripe.com/docs/payments/save-and-reuse?platform=web
However not sure how that fits with the Flutter lib
We are just saving some basic information about the payment method like the type, its id and last4.
For 3DS we are constantly returning URLs to the app, if there are any steps for the customer to take.
So if the customer later tries to pay with this saved payment method he may be prompted to confirm his choice and payment with 3DS.
And this works perfectly well for Apple Pay. But for Google Pay I get this weird Card details not complete as soon as I try to create the payment method directly for Stripe.
So if the customer later tries to pay with this saved payment method he may be prompted to confirm his choice and payment with 3DS.
That won't work with off-session payments though (they'll just error)
I'd recommend filing an issue on the Flutter repo: https://github.com/flutter-stripe/flutter_stripe
Hmm it works with saved Apple Pay payment methods. ๐ค
Alright
Well generally with wallets the auth is done when the user adds the card to their wallet