#guimatos_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/1353813880975130726
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Can you share the code you're working with?
IIRC you need to set https://docs.stripe.com/connect/supported-embedded-components/account-onboarding?platform=web#requirements-collection-options to collect some of the required docs
๐งโ๐ป How to format code on Discord
Inline code: wrap in single backticks (`)
This:
The variable `foo` contains the value `bar`.
Will turn into this:
The variable
foocontains the valuebar.
Code blocks: wrap in three backticks (```)
Also, you can specify the language after the first three backticks to get syntax highlighting.
This:
```javascript
function foo() {
return 'bar';
}
```
Will turn into this:
function foo() {
return 'bar';
}```
Notes about **code blocks**:
- Specifying the language is optional (e.g., you can omit `javascript` in the example above)
- If you don't specify the language you won't get syntax highlighting
- When you're inside a code block (after you type \`\`\`) the `Return`/`Enter` key will add a new line instead of sending your message
- Once you end the code block `Return`/`Enter` works normally again
You can [read more about message formatting on Discord's website.](https://support.discord.com/hc/en-us/articles/210298617)
Can you share the code in text? You can follow the instructions above for formatting ^
ahh ok @formal fable
type: "custom",
country: "BR",
capabilities: {
card_payments: { requested: true },
transfers: { requested: true },
},
business_type: "individual",
external_account: {
object: "bank_account",
country: "BR",
currency: "brl",
account_holder_name,
account_holder_type: "individual",
routing_number,
account_number,
},
individual: {
first_name: firstName,
last_name: lastName,
id_number: cpf,
political_exposure: "none",
dob: {
day: parsedBirthdate.getDate(),
month: parsedBirthdate.getMonth() + 1,
year: parsedBirthdate.getFullYear(),
},
email,
phone: phoneNumber,
address: {
city: address.city,
country: address.country,
state: address.state,
line1: address.line1,
line2: address.line2,
postal_code: address.postal_code.replace('-', ''),
},
},
business_profile: {
mcc: "7298",
product_description: "Online marketplace connecting tattoo artists with clients for custom tattoo services.",
monthly_estimated_revenue: {
amount: 1000,
currency: "brl",
}
},
tos_acceptance: {
date: Math.floor(Date.now() / 1000),
ip: context.rawRequest.ip || "0.0.0.0",
user_agent: context.rawRequest.headers["user-agent"] || "Unknown",
},
});`````
this is the function to create the connect account
this is the function to create the session account
account: stripeAccountId, // Ensure correct casing and data key names
components: {
"account_onboarding": {
"enabled": true,
"features": {
"external_account_collection": false,
"disable_stripe_user_authentication": true
}
},
"documents": {
"enabled": true,
"features": {}
},
}
});````
and this is the react component to load the stripe and render the flow of onboarding and complete profile
const OnboardingStripe = ({ stripeAccountId, handleNextStep }) => {
useEffect(() => {
// Only initialize if we have user data and the Stripe account ID is available.
if (!currentUser?.data || !stripeAccountId) return;
const initializeStripeConnect = async () => {
const fetchClientSecret = async () => {
try {
// Pass the account ID to your API so that session creation waits for connect account.
const createSessionAccount = callFirebaseApi("createSessionAccount");
const response = await createSessionAccount({ accountId: stripeAccountId });
const {
data: { clientSecret },
} = response;
if (!clientSecret) {
throw new Error("Client secret not found");
}
return clientSecret;
} catch (error) {
console.error("Failed to fetch client secret:", error);
return null;
}
};
try {
const instance = await loadConnectAndInitialize({
publishableKey: import.meta.env.VITE_REACT_APP_STRIPE_PUBLIC_KEY,
fetchClientSecret,
appearance: {
overlays: "dialog",
theme: "light",
},
locale: "auto",
});
setStripeConnectInstance(instance);
} catch (error) {
console.error("Failed to initialize Stripe Connect:", error);
}
};
initializeStripeConnect();
}, [currentUser, stripeAccountId]);
}
return (
<div className="mb-5"
<ConnectComponentsProvider connectInstance={stripeConnectInstance}>
<ConnectAccountOnboarding onExit={(exitData) => handleNextStep(exitData)} />
</ConnectComponentsProvider>
</div>
);
};
export default OnboardingStripe;
ok, i'll try
looks that it works!
@formal fable, last question
it's possible to get the "loading" status of the component?
๐ stepping in here as hanzo needed to step away
You would use onLoaderStart to know when the component is loading: https://docs.stripe.com/connect/get-started-connect-embedded-components?platform=web&client=react#reacting-to-component-display
Yep for all Embedded Components
nice
just one more
we building a marketplace of tattoo artist, where clients can book tattoo sessions
once the artist approve a tattoo request, we have to check if their stripe account is with status "Complete" (green)
if is not, I want to redirect them to complete the profile information
to this, is just create a new account session ?
If you want to check the status of their account you can retrieve it and check whether charges/payouts are enabled for the account, see: https://docs.stripe.com/api/accounts/object#account_object-charges_enabled / https://docs.stripe.com/api/accounts/object#account_object-payouts_enabled
Or you can look if they have outstanding requirements to get more granular: https://docs.stripe.com/api/accounts/object#account_object-requirements