#guimatos_api

1 messages ยท Page 1 of 1 (latest)

honest ingotBOT
#

๐Ÿ‘‹ 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.

formal fable
honest ingotBOT
#

๐Ÿง‘โ€๐Ÿ’ป 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 foo contains the value bar.

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)
formal fable
#

Can you share the code in text? You can follow the instructions above for formatting ^

scarlet plaza
#

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;
scarlet plaza
#

ok, i'll try

honest ingotBOT
scarlet plaza
#

looks that it works!

#

@formal fable, last question

#

it's possible to get the "loading" status of the component?

rustic temple
#

๐Ÿ‘‹ stepping in here as hanzo needed to step away

scarlet plaza
#

i need to implement a skeleton for this component

#

hi, @rustic temple

rustic temple
scarlet plaza
#

perfect

#

it works for the ConnectAccountOnboarding also, right?

rustic temple
#

Yep for all Embedded Components

scarlet plaza
#

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 ?

rustic temple
scarlet plaza
#

perfect !

#

i think we can close