#Dan.b - Google Pay
1 messages ยท Page 1 of 1 (latest)
๐
I'm trying to break down your 'graph into steps so I can better understand what is going on here
So the request that is failing is the request to /v1/payment_intents?
Can you share a request ID?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Can you try the same flow just on your account? Without the connected account?
Sorry, Im not sure what you mean. How would I change that?
Exclude the Stripe Account header
yup, gimmie a moment
That appears to allow me to create a paymentmethod! Never would have figured that one out on my own. Thanks so much!
Is there a guide to when to use the requestoptions stripeaccount header and when not to? I know we use it for paymentintent.
Yeah sometimes the whole tokem -> payment_method flow doesn't work so well when the token belongs to one account and the payment_method request is made by another.
With connected accounts
Thats totally understandable
So should I include the account header in this paymentintent or exclude it. The previous working code included it.
Okay so just to be clear, you are using Standard Accounts with Direct charges, correct?
These are going to be used in connected accounts
Right but we have 3 kinds of connected accounts. The one from the request you shared is a Standard account so I'm guessing you'll probably be using those.
How would I check?
It says so in the platform dashboard
Under Connected Accounts
And with respect to charges, I find the table on this page very helpful: https://stripe.com/docs/connect/charges
yup, under the account im testing it its says standard
Creating a paymentintent with the new paymentmethod results in an error now:
Stripe.StripeException: 'No such PaymentMethod: 'pm_1KHchuGpko9Q3UHCjWOSQrHW'; OAuth key or Stripe-Account header was used but API request was provided with a platform-owned payment method ID. Please ensure that the provided payment method matches the specified account.'
Okay so the problem is that the Google Pay integration will always create the token on the Platform account
Ahhh, makes sense
And in order to follow the proper funds flow, all these objects need to exist on the connected account
However there is a hack...
I like hacks
We have other recommended integrations with Google pay but I'll save those
Google provides documentation on how to tokenize without using connect
Yeah we have used stripe's button / easy integration, but for...reasons were making this implementation
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
"gateway": "stripe"
"stripe:version": "2018-10-31"
"stripe:publishableKey": "pk_test_123"
}
};
use the old version?
I've worked at places that had ...reasons. I can understand that
Well wait...that's just an example
To use the native Google Pay API with Connect you can pass the platform's publishable key and the connected account's ID the same way Stripe.js does when used with Connect
const tokenizationSpecification = {
type: 'PAYMENT_GATEWAY',
parameters: {
"gateway": "stripe"
"stripe:version": "2018-10-31"
"stripe:publishableKey": "pk_test_123/acct_123"
}
};
In other words, use the platform's publishable key + a forward slash + the connected account ID for the stripe:publishableKey value in order to tokenize on the connected account.
Otherwise, here's the flow:
- Token on platform
- Payment Method on Platform
- Attach Payment method on Platform
- Clone customer & PM to connect account
- process paymentIntent on connected account
so testing this and I think google hates it
"tokenizationSpecification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "stripe",
"stripe:version": "2018-10-31",
"stripe:publishableKey": "pk_test_123/acct_123"
}
}
Results in 'Invalid stripe:publishableKey for current environment. Make sure you are using Stripe's test key.' errors coming from the google payment sheet.
But im pretty sure thats only from google as i dont even see it hitting stripe in the logs at /v1/tokens
Okay I'm assuming you are using the actual platform pk_test_xxx key as well as the connected accounts ID. Just making sure.
Yeah I obfuscated before I pasted
Okay cool. I just like to check because I've spent a long time going back and forth while something like that was happening
I confirmed they are keys that are in the api keys section and match the accountId in connect
Okay well that was only only sneaky option. Otherwise it's the involved process I outlined above.
Got it. Well, Thanks so much for your help, at least I have a path to work with ehre.
here*
I hope it works out for you...or you can convince those with reasons that the tech debt is too high and the request button option is more maintainable
https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#html-js-using-with-connect