#musacoli - stripe.js connect init
1 messages · Page 1 of 1 (latest)
Hi there
subscription = stripe.Subscription.create(
metadata=metadata,
api_key={{our_stripe_api_key}} if live_mode else {{OUR_STRIPE_TEST_APIKEY}},
currency=product.currency,
customer=user.stripe_uid,
items=line_items,
stripe_account={{customer_connect_account_id}},
application_fee_percent=app_fee_perc,
trial_end=trial_end,
payment_behavior='default_incomplete',
payment_settings={
'save_default_payment_method': 'on_subscription',
'payment_method_types': ['card'],
},
expand=['latest_invoice.payment_intent'],
)```
Let's use this thread
Thanks
Yep so you initialize client-side using your publishable key and setting the Stripe Account of your Connected Account. See: https://stripe.com/docs/connect/authentication#adding-the-connected-account-id-to-a-client-side-application
Yes, we have this running on both FE and BE
FE
stripeAccount: {{customer_stripe_account}}
});
Hmm and you are still seeing the error?
Can you share a request ID for that error?
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.
Ah nvm
Forgot it is in the logs you shared above
One sec
All good
Here is the one for the client_secret_error
message
:
"The client_secret provided does not match any associated PaymentIntent on this account."
param
:
"client_secret"
request_log_url
:
"https://dashboard.stripe.com/test/logs/req_dzJCnyZZg68785?t=1671478289"
type
:
"invalid_request_error"
Okay yeah that PaymentIntent confirmation request looks to have been performed on your platform whereas the Sub was created on your Connected Account
So yeah can you try again but using the const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || '', { stripeAccount: {{customer_stripe_account}} }); code?
Also have you logged customer_stripe_account there?
I am actually hard coding it in, just for extra measure 🤣
So still got the same error
Can you do a full reboot of your app?
Sure thing
It seems cached in that case where Stripe.JS isn't getting initialized for your Connected Account
Cleared Cache
Rebooted the application
Cleared Cache again
Still the same error sadly
Okay in that case can you share your relevant client-side code?
Sure thing.
Like a repo, or snippets
snippets are fine
Also have you logged out the client secret in your frontend?
That your server is passing?
Okay yeah that is the correct client-secret for a Sub on your Connected Account. So really the issue is with the Stripe intialization
Have you tried hard coding your publishable key as well?
Nope, let me try that
Yahp, I just did
Same error
Is the payload for the stripe.js requests meant to include the stripe account id, because it currently doesn't
Yes if i recall that should be includes as the stripe-account header
It looks like your initialization includes the correct stripeAccount option & value
Can you share an example request ID happening from the client?
Here is one
{
"error": {
"message": "The client_secret provided does not match any associated PaymentIntent on this account.",
"param": "client_secret",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_tvZvJRcIooCzaf?t=1671480069",
"type": "invalid_request_error"
}
}
Hmm yes there is no connected account set there
in teh snippet you shared the connected account was hard-coded
is that the case in prod or is the value dynamic?
That's the case
This is still something in development, so what I have is what's on my branch and being tested with to get the shared error
hmmm can that is weird, you definitely have a value there
Can you try removing the || ''?
I think I've figure it out
Let me test and let you know
I found two instances of the loadStripe
It's a wild guess but wondering if the || is smooshing the options object
ahhh
Yea, that would do it, guessing the other doesnt have the connected account set?
Exactly
And we're good to go
Thanks a bunch both of you
Much appreciate the assistance
NP! glad its working now!
musacoli - stripe.js connect init