#rocky_code

1 messages ยท Page 1 of 1 (latest)

random graniteBOT
#

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

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

compact elk
#

Hello Snufkin, how's it going?

golden lily
#

Hi ๐Ÿ‘‹

Do you have specific scenarios regarding webhooks you have questions about?

compact elk
#

yea, I'm trying to get some code on the front end to run after completion of the webhook, basically the setup is a little strange but I'm using stripe connect for my marketplace so I can pay out individual sellers. I've gotten to the point of setting up the payment intent and allowing people to actually complete their payments. To stop the page from regenerating a payment intent every time it is loaded I'm storing the client_secret in localStorage (probably not the most secure, but I think it's questionably ok?), so when the checkout page loads it looks in localStorage for the secret of which charge it should display. I need to clear the localStorage after the checkout has completed and I'm unsure of how to listen for the webhook on the front end to then subsequently run localStorage.removeItem() or localStorage.clear() or whatever to get rid of the old saved payment intent

#

sorry I didn't mean to hit enter lol

#

my bad hold up

golden lily
#

Webhook handlers need to be in your server-side code. Any front-end responses would likely need to be triggered by your front-end and server communicating

compact elk
#

that makes sense, but working in node, do you know if there is any way to listen for the webhook completion from the front end?

golden lily
#

No there is not

compact elk
#

ok, damn that makes sense but interesting, it would be easier to have the ability to work with it from the front end, but everything is still very possible from the backend so thank you, that makes sense but I didn't really expect that to be the case

golden lily
#

Yeah, there is just too much sensitive data potentially in the webhook events to expose them to an environment you don't control (i.e. the front-end).

compact elk
#

alright second question rq, is there any way to remove the query string params from the url on redirect back to the .confirmPayment's return_url? like I have a setup like:

const { error } = await stripe.confirmPayment({
      //`Elements` instance that was used to create the Payment Element
      elements,
      confirmParams: {
        return_url: "http://localhost:4000/cart"
      }
    });

and the return_url when actually completing the checkout brings me to /cart?payment_intent=pi_3PhwbXAI6vEkS2ui2AAnMsM3&payment_intent_client_secret... is there any way to stop these query strings from being added on, or is the best thing to do just check for the query string on the front end and redirect if need be, and thus enabling running of front end code on completion if needed?

#

yea that makes alot of sense, there is tons of sensitive information, sending that back to the front end just seems dangerous if there was a man in the middle or anything like that

golden lily
#

So you don't want the extra query parameters to be returned when the customer is redirected?

compact elk
#

if possible, is there a way to pick and choose what query params are there, or is it 100% on 100% off? or not even able to be edited? it should be pretty easy to redirect the user back to just like /cart, but is there any customization on the query params or is it just they are added and work with it?

golden lily
#

I think the later is the case. The intent is to allow you to retrieve safe details about the payment that you can display to your customer. But you are free to ignore them or even redirect your user to a URL without them present.

compact elk
#

bet, sounds good, thank you

golden lily
#

Happy to shed what ๐Ÿ’ก I can ๐Ÿ™‚

compact elk
#

I got that all working, so now the user checks out then it redirects back to the query params page, checks the localStorage, and then if it matches the query param clears it and redirects. Final question, and idk if this will be a quick or a long answer, hopefully not too bad, but I originally set up this project to use stripe standard, and when asking some questions about setup I learned that stripe connect is the way I should be doing what I want to do, basically my question is with stripe standard there's the line_items which you declare a price for and it displays them on the checkout page, I went on this whole journey setting up stripe connect because I originally wanted to add sales pricing to the checkout page, something like $70.00 $35.00 and I learned there wasn't really a way to do that with stripe standard, my question is what is the correct way I should go about setting up the checkout page with items with stripe connect, should I create my own custom item display or is there an item display component already? and if there is an item display component how do I go about using it?

golden lily
#

Sorry but that's kind of a jumble. What is the specific thing you are trying to achieve here?

compact elk
#

sorry, basically this display to show the items a user has in their cart, the cart page already has something but is there a component for like an itemized cart? And if so how do I use it? Like how do I actually tell it "here are the items I want"?

golden lily
#

Are you asking if Stripe has some sort of cart element?

compact elk
#

yea exactly, I know that stripe has a cart element, but with stripe connect is there some sort of cart element? and if so does it just take items via props or how does it work?

#

I'm sure there probably is given that stripe has one, I don't see why stripe connect wouldn't given it seems more tailored to customization and allowing devs to do whatever they want with the elements provided to still create a decent and secure payment form

golden lily
compact elk
#

yea I don't see it there, I was referring to the cart "element" that's created on the stripe sessions checkout page, but it seems that it's just html on the page rather than a specific component, this is what I was referring to, but it seems like it's not an element

golden lily
#

That is the Checkout Session

compact elk
#

like on the left is what I meant by the cart element, but yea it's not an element

golden lily
#

No that is an entire payment page

random graniteBOT
compact elk
#

yea that makes sense. Alright final question, I'm sorry about so many and I really do appreciate your help, but this one's kinda a doozy, how do I add an address element and calculate tax off that? Is there a way to do that with stripe connect?

golden lily
compact elk
#

connected accounts?

#

as in like my company gets paid, the person who made the product gets paid, tax is collected based on the location of the person who made** the product?

#

or what do you mean by connected accounts? I'm sorry I don't quite understand

#

and bet I will look into the docs, thank you for the links

golden lily
#

You have been referencing using Stripe Connect. The Platform and Connected Account are the fundamental objects in this type of integration. It is critical you know what those are so I recommend you review our Connect documentation. This is how we refer to all of the accounts invovled in these integrations
https://docs.stripe.com/connect/overview

compact elk
#

bet thank you for the references

#

I pretty much just got the word from a dude on another server telling me that using stripe standard would go against ToS and I should use stripe connect, so I went on the connect dashboard and signed up and just went through some of the very basic docs, so thank you for the references I will be reviewing em

#

so is the connected account my stripe account because it's what is actually running all the payments

#

?

#

then the users are sub accounts under my account?

thin sentinel
#

I would recommend bringing these types of questions to support, as they're fairly well-documented and we are here to talk about technical API integration questions: https://support.stripe.com/contact

compact elk
#

no my account is the platform account, the connected accounts are the user accounts

#

sorry, and oh ok, sounds good I appreciate it