#vell_2x

1 messages ยท Page 1 of 1 (latest)

quaint citrusBOT
fierce spade
#

Hello, what is your question?

real badger
#

// 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}}',
}
);

#

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

fierce spade
#

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?

#

Secret keys should not be included in public messages like on this server

real badger
#

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

fierce spade
#

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?

real badger
#

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/

fierce spade
#

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

#

This sounds like the API client is not being set up properly

real badger
#

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);
});

fierce spade
#

Yeah definitely try that list call just before.

#

That call should work as long as the API client is set up

quaint citrusBOT
real badger
#

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

fierce spade
#

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?

real badger
#

I will try that, but i create customers just fine. If it was my secret key nothing would work right?

stark moss
#

๐Ÿ‘‹ stepping in here as Pompey needs to step away

real badger
#

ok np

stark moss
#

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?

real badger
#

So in Connect setting under Integration I see Live mode client ID starts with ca_... what does that do/for?

stark moss
#

You can mostly ignore that

#

It would be for the legacy OAuth flow that was used to connect accounts

real badger
#

Everything works in test mode, and everthing except Connect accounts work in Live mode

stark moss
#

But you should not need to use that anymore with the new Connect Onboarding flow

real badger
#

I am using Express

stark moss
#

In your code can you log out stripe in the line before const account = await stripe.accounts.create({

real badger
#

ok one sec