#bajay_api

1 messages ยท Page 1 of 1 (latest)

sick quartzBOT
civic ingotBOT
#

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.

sick quartzBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1254762556472430683

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

steep quail
untold forge
#

Can you share the URL please

steep quail
#

how am i getting the wrong url

#

should i share the code?

untold forge
#

Sure!

steep quail
#

the function was exceeding the character limit so i sent as file

untold forge
#

How are you redirecting to the payment page?

steep quail
#

this function sends the session id here to my endpoint and i send the id to frontend
if (sessionId != null)
{
return Ok(new { sessionId });
}

#

if (response.status === 200) {
const session = response.data;
const result = await stripe.redirectToCheckout({
sessionId: session.sessionId,
});

    if (result.error) {
      toast.error(result.error.message);
    }
  } else {
    toast.error(`Error: ${response.status} - ${response.statusText}`);
  }

this is how i receive it on frontend

#

this was working fine before when i was dealing with destination charges. did multiple payments too

untold forge
#

FWIW, redirectToCheckout is deprecated now. You can just redirect server-side using the url field returned

Can you share the code you use to initialise Stripe.js?

steep quail
#

yes wait

untold forge
#

I suspect you're missing the stripeAccount parameter which is needed for direct charges

steep quail
#

var requestOptions = new RequestOptions
{
StripeAccount = receiverAccount.StripeId,
};
this one i am missing?

untold forge
#

You have it in your server-side code yes

#

But you also need to initialise Stripe.js the same way

steep quail
#

no stripeaccount is not missing

#

i am sure of that

untold forge
#

Can you share the code you use to initialise Stripe.js?

steep quail
#

if stripe account was missing then it would have given an exception and it wouldn't have sent a url

steep quail
untold forge
#

Yes, client-side

#

Not the server-side code, I can see you have it there and the session is created as a direct charge

steep quail
#

import { loadStripe } from "@stripe/stripe-js";

const stripePromise = loadStripe(
"pk_live_xyz"
);

untold forge
#

So, yes, it's missing

steep quail
#

this is in my layout

untold forge
#
const stripePromise = loadStripe(
  "pk_live_xyz", {
    stripeAccount: "acct_connctedAccount"
  }
);
#

redirectToCheckout needs that to correctly construct the URL for direct charges as the session is created on the connected account

civic ingotBOT
steep quail
#

let me explain you about my platform so you can tell me which stripe account should i use here. my platform is named sponsa and on my platform there are creators and supporters. creators are connect account and supporters pay through checkout session. now on client side which stripe account should i use? platform stripe account?

untold forge
#

No, the acct_xxx ID of the connected account you're creating the session for (acct_1PQqxZBeLTv8moMX in this example)

steep quail
#

you mean of the creator in my case?

untold forge
untold forge
steep quail
#

so i have to pass the stripe account to frontend everytime i create a checkout session? i have many creators

untold forge
steep quail
#

can you tell me how to do the recommended integration and redirect server-side?

#

is it in the link?

steep quail
#

let me check this and get back to you

#

can you please not close the thread

steep quail
#

thank you so much for your help