#vell_2x
1 messages ยท Page 1 of 1 (latest)
Hello, what is your question?
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('sk_test_51Mj9dFGQVpwkvutOIT5MjLTz1cDoTXY7Xb3wTvBfZGEs3v7TEwSoq6VZHc6hio2Vysy6WXm7Y57MZ2lohbB5VCGn00AWa6B49y');
const paymentIntent = await stripe.paymentIntents.create(
{
amount: 1000,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
this is the example snipet provided. If I am creating the account for the first time how will I have the account ID or is that suppose to be my api key?
line 14
In theory you should only be creating an intent like that after you have already onboarded the connected account
That parameter is expecting an ID like acct_1234
Do you have any test connected accounts in test mode?
Also I would reccommend that you roll your test mode secret key https://stripe.com/docs/keys#rolling-keys
Secret keys should not be included in public messages like on this server
My test connected accounts work fine but when I switch to production it says I am missing an API key
thanks I forgot the examples include my key
Can you send me the exact error you are seeing about the API key being missing? Can you make other API calls with that key?
Yes all the call go through fine until I try to make a call to create a new connect account
I am getting this error:
UnhandledPromiseRejectionWarning: Error: You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/
Find help and support for Stripe. Our support site 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.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hey @real badger apologies but I missed your reply for a bit. Can you send me your code for how you are making that call?
That is strange if you can make other API calls in a similar way
Can you do me a favor and make a list customer call just before you make this call? See if that gets the same error https://stripe.com/docs/api/customers/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This sounds like the API client is not being set up properly
app.post('/v1/accounts', async (req, res) => {
const postData = req.body;
console.log("Body: ", req.body);
console.log("Email: ", req.body.email);
console.log("Pro ID: ", req.body.proid);
// See your keys here: https://dashboard.stripe.com/apikeys
const account = await stripe.accounts.create({
type: 'express',
email: req.body.email,
business_type: 'company',
});
res.send(200);
});
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yeah definitely try that list call just before.
That call should work as long as the API client is set up
it does in test mode. Idk why live is different. In Connect settings I do see a Live mode client ID. I am not using it and idk how to use it. I think thats what is causing the issue
Have you double checked that your live configuration has a valid secret key?
Like can you print it out just before you pass it in to the stripe client?
I will try that, but i create customers just fine. If it was my secret key nothing would work right?
๐ stepping in here as Pompey needs to step away
ok np
Hmm so you are saying that only certain requests are seeing this error but other requests work?
Or all livemode requests experience this error but testmode works?
So in Connect setting under Integration I see Live mode client ID starts with ca_... what does that do/for?
You can mostly ignore that
It would be for the legacy OAuth flow that was used to connect accounts
Everything works in test mode, and everthing except Connect accounts work in Live mode
But you should not need to use that anymore with the new Connect Onboarding flow
I am using Express
In your code can you log out stripe in the line before const account = await stripe.accounts.create({
ok one sec