#ibookedonline_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/1286688210168057878
๐ 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.
- ibookedonline_code, 1 day ago, 44 messages
cs_test_a1B9HGGSmQAtWVcHPXQLBQ13VhcbRIsIVeFeSj1YWtsUdsiupc1XmvaWo6#fidkdWxOYHwnPyd1blpxYHZxWkI0b0hqcVVUcjNQXzB9TH9HZGJvX0swRycpJ3Zxd2x1YERmZmpwa3EnPydkZmZxWjRNdWZcf05vTDd9RzcwfTUnKSdobGF2Jz9%2BJ2hwbGEnPyczYzA0MTY8ZCg1YTU3KDE0NmQoZzMxZCg2ZmdmPGYxPWdhNGQyNzAxMDwnKSd2bGEnPycxMzM8PTI2PChjYD1mKDExNWQoZzc9PShhNmEzZjU9ZjUyMTZgZmQ3NjUnKSdicGxhJz8nS0QneCknZ2BxZHYnP15YKSdpZHxqcHFRfHVgJz8ndmxrYmlgWmxxYGgnKSd3YGNgd3dgd0p3bGJsayc%2FJ21xcXV2PyoqbGdqam5gYWpraWxrYCtmamgneCUl
I'm able to visit the link fine
How are you redirecting to it?
Please share the code
Oh that checkout session id is different from the one in your screenshot
Likely the one in your screenshot is expired
wait, i shared you wrong one
wait
cs_test_a1v2H8XjaAvURFipYDp6BMgXYoD4e6HIkzuTEJyJmfslKV2lZz7iDayZIP#fidkdWxOYHwnPyd1blpxYHZxWkI0b0hqcVVUcjNQXzB9TH9HZGJvX0swRycpJ2hsYXYnP34naHBsYSc%2FJzw9MzI0N2M8KDdhPWcoMT
var stripe = '';
if('@cartProductCompanyDetailsSession?.UseLiveTransactions' == 'True'){
stripe = Stripe('@cartProductCompanyDetailsSession?.StripeLivePublishableKey');
}
else {
stripe = Stripe('@cartProductCompanyDetailsSession?.StripeTestPublishableKey');
}
if ($("#chkTermsAndConditions").prop('checked') == true) {
var obj = {
['type']: 'GET',
['url']: base_url + '/addproductpurchasedetails/' + companyName,
}
var result = await AjaxCall(obj);
if (result.status && result.stripeId && result.stripeId.length > 0) {
return stripe.redirectToCheckout({ sessionId: result.stripeId });
}
else {
statusMessageModal(false, result.message);
}
}
Okay
You should just return the url from the checkout session creation request back to your frontend
And then use javascript to redirect to it
I'm able to view that above session just fine
So likely it's how you're redirecting to it
Sorry, can you please tell me where is the issue?
above is front end code and file I shared with you have backend c# code
Can you please share me any sample code?
Don't use redirectToCheckout
That's deprecated
You need to just return the url from the checkout session object to your frontend
Then redirec to that with plain javascript
Or do a server-side redirect
Here, don't have javascript front-end example
That uses a server-side redirect
But the code to redirect to a page using javascript is very basic
return stripe.redirectToCheckout({ sessionId: result.stripeId });
earlier, I have added only this line and it redirected to the stripe checkout page
Now, I need to write chekcout page url and session as a parameter to it
I know for url redirecting I can write window.location,href but inside it
Hi there ๐ jumping in as my teammate needs to step away soon. I think the problem here is that you're creating these Checkout Sessions directly on your Connected Accounts, so you need to initialize stripe.js as the Connected Account as well in order for it to be able to find the Checkout Session correctly.
If you set the stripeAccount option to the ID of your Connected Account when initializing stripe.js, are you then able to redirect to the session?
redirectToCheckout is deprecated and it's typically better to return a redirect response to your frontend that sends your customer to the Checkout Session's URL, but I think my advice above will help redirectToCheckout not fail.
If you set the stripeAccount option to the ID of your Connected Account when initializing stripe.js, are you then able to redirect to the session?
Can you please tell me where in my front-end code?
stripe = Stripe('@cartProductCompanyDetailsSession?.StripeTestPublishableKey'); >> to this line
please, check this code , I have added stripe connect id
you mean like this
var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx', {
stripeAccount: {{CONNECTED_ACCOUNT_ID}},
});
Apologies, I meant to link you to our stripe.js reference that shows the structure for all of these:
https://docs.stripe.com/js/initializing#init_stripe_js-options-stripeAccount
Yes, like that
key will be platform account key right, not connected account key
Correct, platform's publishable key and the ID of the Connected Account.