#alechu_code

1 messages ¡ Page 1 of 1 (latest)

hot sedgeBOT
#

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

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

rancid fern
#

Code got cut out:

export const StripeCheckoutForm = ({
  propertyId,
  leasePrice,
  paymentType,
  stripeAccountId,
}) => {
  const stripePromise = useMemo(
    () =>
      loadStripe(`${process.env.REACT_APP_STRIPE_PUBLIC_KEY}`, {
        stripeAccount: stripeAccountId,
      }),
    [stripeAccountId]
  );
  const fetchClientSecret = useCallback(async () => {
    const res = await axiosClient.post("/create-instance", {
      propertyId,
      price: leasePrice,
      paymentType,
      stripeAccountId,
    });

    return res.data.client_secret;
  }, [propertyId, leasePrice, paymentType, stripeAccountId]);

  const options = { fetchClientSecret };

  return (
    <>
      <Header />
      <div
        id="checkout"
        className="flex flex-col justify-between h-screen"
        style={{ backgroundColor: "#222944" }}
      >
        <EmbeddedCheckoutProvider stripe={stripePromise} options={options}>
          <EmbeddedCheckout className="mx-4 lg:mx-0 lg:mt-8" />
        </EmbeddedCheckoutProvider>
        <Footer
          whiteText
          style={{ backgroundColor: "#222944", marginTop: 5 }}
        />
      </div>
    </>
  );
};
delicate laurel
#

Could you share the example Checkout Session (cs_xxx), so that I can take a look?

rancid fern
#

Sure, its this one cs_test_a1wxPU734JXyrwy9uX1hzz7HPIT1H3gdp6zSt2qVXFXfjP8FBduQ6znbZj_secret_fidwbEhqYWAnPydgaGdgYWFgYScpJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ3dgYWx3YGZxSmtGamh1aWBxbGprJz8nZGlyZHx2JyknZ2RmbmJ3anBrYUZqaWp3Jz8nJmNjY2NjYyd4JSUl

mild ironBOT
delicate laurel
#

In https://dashboard.stripe.com/test/logs/req_JxVt40rTIx9l00, the Checkout Session was created on the Custom connected account using Direct Charges.

Direct Charges is only recommended on the Standard connected account.

For Custom Connected account, Destination Charges with on_behalf_of should be used: https://docs.stripe.com/connect/destination-charges?platform=web&ui=stripe-hosted#settlement-merchant with https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-on_behalf_of

Create charges on your platform account, collect fees, and immediately transfer the remaining funds to your connected accounts.