#mladen_api

1 messages ¡ Page 1 of 1 (latest)

still oceanBOT
#

👋 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/1286004239813841080

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

upbeat perch
#

Hello! When creating a new account you must make the API request on your platform. The request you shared is trying to create a new account on one of your connected accounts, not your platform account. It's likely your code is setting a connected account ID somewhere when it shouldn't be.

#

That page explains how you make API calls on your connected accounts, which is what you shouldn't be doing when creating a new account.

#

Does that make sense? If not, no worries, happy to explain another way!

wild siren
#

Hello, thank you for fast response. I'm looking at our code right now, I can share the part where we create an account:
public Account createAccount() {
try {
final AccountCreateParams accountCreateParams =
AccountCreateParams.builder().setType(STANDARD).build();
return Account.create(accountCreateParams, requestOptionsBuilder.build());
} catch (final StripeException ex) {
throw new StripeApiException(
ex.getMessage(), ex.getRequestId(), ex.getCode(), ex.getStatusCode());
}
}

#

As you can see, nothing unusual here

#

in requestOptionsBuilder we provide API key

upbeat perch
#

Can you show me that code?

#

With the API key removed, of course?

wild siren
#

public RequestOptions.RequestOptionsBuilder requestOptionsBuilder() {
return RequestOptions.builder().setApiKey(apiKey);
}

upbeat perch
#

Do you have setStripeAccount anywhere?

wild siren
#

let me double check

#

Oh, I have just figured it out with your help. We do have setStripeAccount when we are creating Price and CheckoutSession
The problem is, we are using THE SAME requestOptionsBuilder for all requests
so when we make first call to create price or checkout session it gets dirty
and all subsequent calls to create new account fails

#

Thank you vary much!

upbeat perch
#

Ah, yep, that's the issue.

wild siren
#

Again, thank you very much, you were very helpful

#

Have a great day