#deathraven_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1479192903309070510
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
basically i wanted to add a minimum balance to avoid the 2 dollars per account fee for sellers that havent met the sell limit
for (const user of users.data) {
try {
const balanceSettings = await stripe.balanceSettings.update(
{
payments: {
payouts: {
schedule: {
interval: "monthly",
monthly_payout_days: [5, 20],
},
"minimum_balance_by_currency": {
"usd": 10000,
},
},
},
},
{
stripeAccount: user.stripe_account,
},
);
} catch (e) {
console.error(e);
return useJsonResponse({
message: "Error updating balance settings",
error: e.message,
}, 500);
}
}
hello! looking at this shortly, gimme just a bit
can you share an example request ID (e.g. req_xxxxxx) that resulted in this error?
can you copy + paste the ID itself here so i don't run the risk of misreading characters?
also all of those look like 200s, is there an example 400 / other error?
no you misunderstood me: i dont have any errors in the logs the api just returns it
can you share a connected account ID where you tried to make this update? i can try to look up the logs from there
the request ID should also be available in the response you get from stripe
ok cool
i don't think i've seen this specific error before so gimme a bit to dig through our logs + code etc to figure out what causes it
yeah no problem. i will take the chat with me but i wont be able to make changes. my timing sucked there :D
just for reference
import { useJsonResponse } from "../_shared/general/jsonResponse.ts";
import { sendNewPublishEmailToFollowers } from "../_shared/Services/EmailService.ts";
import {
deferedImageOptimisation,
downloadImage,
getPublicUrlForImages,
makeS3SafeFilename,
} from "../_shared/Services/ImageService.ts";
import { useAdminSupabase } from "../_shared/useAdminSupabase.ts";
import Stripe from "npm:stripe";
const STRATO_URL = Deno.env.get("STRATO_SERVER")!;
const stripe = new Stripe(Deno.env.get("STRIPE_API_KEY") as string, {});
Deno.serve(async (req) => {
if (req.method === "OPTIONS") {
return useJsonResponse({ message: "ok" });
}
const users = await useAdminSupabase().from("private_profiles").select("*")
.eq("account_status", "Seller");
if (users.error) {
console.error(users.error.message);
return useJsonResponse({
message: "Error fetching users",
error: users.error.message,
}, 500);
}
for (const user of users.data) {
try {
const balanceSettings = await stripe.balanceSettings.update(
{
payments: {
payouts: {
schedule: {
interval: "monthly",
monthly_payout_days: [5, 20],
},
"minimum_balance_by_currency": {
"usd": 10000,
},
},
},
},
{
stripeAccount: user.stripe_account,
},
);
} catch (e) {
console.log(e.requestId);
console.error(e);
return useJsonResponse({
message: "Error updating balance settings",
error: e.message,
}, 500);
}
}
return useJsonResponse({ message: "Image optimization completed" });
});
this is the hole updater code
ok i thiiiink in this case you're getting the error because the account in question only has EUR external accounts... have you tried setting a minimum balance on EUR for that account?
looking at the code i think we restrict this to a baseline set of currencies and then those for which the connected account has external accounts, although there are some other restrictions too (the logic is a little complex unfortunately)
I thought so too but: how do I even check that. I tried receiving it first but nothing there
how do you check what external accounts the connected account has? (is this your question)
Yes
good question, lemme double check
you should be able to see this using the Retrieve an Account API, the property you're looking for is buried all the way down here:
https://docs.stripe.com/api/accounts/object#account_object-external_accounts-data-currency
Okay okay last thing: it isn't my tea but the doc for this is extremely weird for the balance object
can you explain what you mean and share specific examples?
I mean exactly my problem. You have examples for updating the data but not reference to the error or that This restriction exists
but can you share which doc you're referencing?
i can take a look at it and provide feedback to our docs team
i also think the error you're running into could be a lot better and could tell you exactly what the problem is, so that's some additional feedback i'll provide to the product team
Extra question: why isnt this in the normal API doc?
do you mean why don't we describe the error in the API doc?
Here we are in the API docs. When I click on the link I get redirected to the page above
sorry i still don't think i understand, what's the problem with the API reference docs linking to the guide?
Cause I am just searching for the object reference
I just want to know what I put in there
oh you mean it doesn't define the structure of the object in the reference docs, so you have to click through to the guide? is that the issue?
if so i can pass that feedback along to our docs team too
Yes