#nerder_error
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1308386517550370867
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi! we don't really directly support Flutter but I can try to help a bit. What is this exact "invalid token id" error, what's the exact code/API call that returns an error?
this is the req_vZ9GHTcf8pmaik
the code is a 400
Invalid token id: tok_1QMp80HTyY8xD8aG7ZEjxD5g
please consider this, i'm using Connect here
yeah it's becaue you're using Connect to process the payment on a connected account, but the Google Pay token was created on your platform, not the connected account.
if you use our official libraries they should create it on the right account based on the params you pass, I don't know what your Flutter library does. If you have some code I can look at that creates the token I might be able to suggest something.
i'm using flutter_stripe which is indeed the offically supported library
which is using the native IOS/Android libraries
there is no officially supported library for flutter (Stripe only supports Android/iOS/React Native), it's a third party
yes, you are right but let's say it's the "Stripe Sponsored" one
but anyway
yes I know all that
in any case , at a really basic/close level, to create the token on the right account the account ID has to be passed within stripe:publishableKey:"pk_xxx/acct_xxxx" in the Google payload (see https://github.com/stripe/stripe-android/blob/95b04597b3300848f1bc04e3b50f171b58eea2ae/payments-core/src/main/java/com/stripe/android/GooglePayConfig.kt#L32-L37 ). That should be done by our libraries, I don't know what code you're using
let me show you some code to understand better
that'd be great
Ok i think i understand!
Consider that i'm using pay to add supporto for Google Pay and Apple Pay which under the hood is using the native libraries for each platforms
and in order to work you need to pass down a configuration in json
something like this
{
"provider": "google_pay",
"data": {
"environment": "TEST",
"apiVersion": 2,
"apiVersionMinor": 0,
"allowedPaymentMethods": [
{
"type": "CARD",
"tokenizationSpecification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "stripe",
"stripe:version": "2022-11-15",
"stripe:publishableKey": "pk_test_xxx"
}
},
"parameters": {
"allowedCardNetworks": [
"VISA",
"MASTERCARD",
"AMEX"
],
"allowedAuthMethods": [
"PAN_ONLY",
"CRYPTOGRAM_3DS"
],
"billingAddressRequired": true,
"billingAddressParameters": {
"format": "FULL",
"phoneNumberRequired": true
}
}
}
],
"merchantInfo": {},
"transactionInfo": {}
}
}
stripe:publishableKey needs to be "$platform_key/$connected_account_id", as you can see in the source code of stripe-android
so probably to fix it i should append /acct_xx at the end?
let me try that real quick
Ok!
now the error is different but I think I can manage it
actually the payment even went trough
now another quick question, I see that the PI has been completed but the payment method has not been saved
did you pass setup_future_usage and a customer object when creating the PaymentIntent?
actually no
Ok so that will be one possible thing
but usually for cards what i do is that i create them on my platform first and then clone the card in the connected account
this is useful as I can enable 1-click purchase across the entire markeplace
while for Google Pay/Apple Pay this might not be as important as at the end their customer experience is almost one click already
I'd love to keep the same behaviour, should i send the token ID to my backend and handle the payment method creation myself there?
technically yes you can do the same thing and clone them (in which case you do not want to apply the change we were talking about earlier)
note also that when you only have a token you need to convert it to a PaymentMethod pm_xxx, which is not clearly documented but the call is described in the docstring at https://docs.stripe.com/api/payment_methods/create#create_payment_method-card
which technically sort of isn't needed, but it's proabably easiest/best to do it since then you can slot into your presumably-existing code that clones PaymentMethods
Yes exactly, It will stay more "consistent" and with Google Pay/Apple Pay we'll improve the overall first purchase experience
from there either reusuing our 1-click purchase or a wallet will be practically identical
probably i'll be creating a new payment method all the time they use Apple Pay/Google Pay
but still
I believe that's normal enough when using those wallets yep
Ok, last question and i'm done
If i don't remember incorrectly
when you pay with Apple/Google pay in checkout the payment method attached to the customer is with the correct logo of Apple/Google
but i'm my case it will just appear as a normal card?
or since i'm creating the pm with the token the dashboard will be able to understand it?
it's mostly for stats
hard to say without knowing exactly what surface/component etc you're seeing this logo in but the PM does store the fact that it came from a wallet so I'd imagine it works the same
i..e https://docs.stripe.com/api/payment_methods/object#payment_method_object-card-wallet is present on a PM that is converted from a token like the ones from that Google integration(and is not present on a PM created just from a card number field)
ok this sounds amazing
so i'll be able to show back in my app and the stripe dashboard instead will display this correctly from the get go
amazing, all is clear now
thank you so much @hollow sigil you are the king
happy to help