#zeke_code
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/1267712285619650642
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- zeke_error, 3 hours ago, 10 messages
- zeke_best-practices, 13 hours ago, 8 messages
What code do you refer to?
This page contains lots of code
Well... This code starts onboarding process and I want to make sure I did it right
it gives me a account ID when pressing the Sign up button. I want to make sure that this right.
And if it is right how can i embedded componets for it to look nice
Why don't you just paste the code here? i.e., the code that return an account ID.
"use client";
import React, { useState } from "react";
import { loadStripe } from "@stripe/stripe-js";
import { useStripeConnect } from "../../hooks/useStripeConnect";
import {
ConnectAccountOnboarding,
ConnectComponentsProvider,
} from "@stripe/react-connect-js";
const stripePromise = loadStripe("your-publishable-key-here");
export default function Home() {
const [accountCreatePending, setAccountCreatePending] = useState(false);
const [onboardingExited, setOnboardingExited] = useState(false);
const [error, setError] = useState(false);
const [connectedAccountId, setConnectedAccountId] = useState();
const stripeConnectInstance = useStripeConnect(connectedAccountId);
const handleSignUp = async () => {
setAccountCreatePending(true);
setError(false);
try {
const response = await fetch("/api/account", {
method: "POST",
});
const json = await response.json();
const { account, error } = json;
if (account) {
setConnectedAccountId(account);
}
if (error) {
setError(true);
}
} catch (error) {
setError(true);
} finally {
setAccountCreatePending(false);
}
};
return (
<div className="container">
<div className="banner">
<h2>Dream Marketplace</h2>
</div>
<div className="content">
{!connectedAccountId && <h2>Get ready for take off</h2>}
{connectedAccountId && !stripeConnectInstance && (
<h2>Add information to start accepting money</h2>
)}
{!connectedAccountId && (
<p>
Dream Marketplace is the world's leading air travel platform: join
our team of pilots to help people travel faster.
</p>
)}
{!accountCreatePending && !connectedAccountId && (
<div>
<button onClick={handleSignUp}>Sign up</button>
</div>
)}
{stripeConnectInstance && (
<ConnectComponentsProvider
stripe={stripePromise}
connectInstance={stripeConnectInstance}
>
<ConnectAccountOnboarding
onExit={() => setOnboardingExited(true)}
/>
</ConnectComponentsProvider>
)}
{error && <p className="error">Something went wrong!</p>}
{(connectedAccountId || accountCreatePending || onboardingExited) && (
<div className="dev-callout">
{connectedAccountId && (
<p>
Your connected account ID is:{" "}
<code className="bold">{connectedAccountId}</code>
</p>
)}
{accountCreatePending && <p>Creating a connected account...</p>}
{onboardingExited && (
<p>The Account Onboarding component has exited</p>
)}
</div>
)}
<div className="info-callout">
<p>
This is a sample app for Connect onboarding using the Account
Onboarding embedded component.{" "}
<a
href="https://docs.stripe.com/connect/onboarding/quickstart?connect-onboarding-surface=embedded"
target="_blank"
rel="noopener noreferrer"
>
View docs
</a>
</p>
</div>
</div>
</div>
);
}
So which line of code returns your an account ID?
{(connectedAccountId || accountCreatePending || onboardingExited) && (
<div className="dev-callout">
{connectedAccountId && (
<p>
Your connected account ID is:{" "}
<code className="bold">{connectedAccountId}</code>
</p>
)}
{accountCreatePending && <p>Creating a connected account...</p>}
{onboardingExited && (
<p>The Account Onboarding component has exited</p>
)}
</div>
)}
Ok So it looks terrible on my part how do i add stripe components to it
I'd suggest you closely follow the integration doc.