#bear-localhost-ip
1 messages ยท Page 1 of 1 (latest)
Hello! what do you mean by "require an endpoint when initiation Stripe"? Do you have more context around your ask?
My bad. All websites need a endpoint where to Stripes sends event requests. I made an integration plugin that fetches all registered endpoints and checks whether the current site has an endpoint registered.
My question is, If im working on a local machines my plugin will check if 127.0.0.1 is registered. If not it will register it. This method is good for live sites. Not so much for dev env.
Is my method considered good practice? Or do you have another idea
I don't understand I'ms orry
what does "all websites need an endpoint"
I worry we just use a different vocabulary. Are you specifically talking about Webhooks: https://stripe.com/docs/webhooks?
@open folio any update?
Yes. Im talking about Webhooks.
All websites integrating Stripe should have a Webhook registered, right?
kind of
If you test locally you should use our CLI tool: https://stripe.com/docs/stripe-cli
Yes Im already doing that
then there's nothing to register at all
But the thing is that on each page request my site checks whether a webhook is registered of that particular site. This is done in every environment: live and dev.
This feature is build with the intention of notifying admins right away when an webhook is not registered. This lessens missing Stripe's status updates.
A scenario. Lets say my plugin only registers a webhook on activating the plugin. If the site installment is transfered to another domain I would have an issue with missing status updates to the new domain.
that doesn't make sense to do at all honestly
How so?
Like it doesn't make sense to have code do that every time, it's really not something I'd advise your plugin from ever doing
I've never seen anyone do this before either
Just to be clear lets walk through a scenario and tell me what you will do.
You are a plugin developer who is developing a Stripe integration for multiple stores of which none of the entrepreneurs have any tech savvy. They only know how to enter their Stripe api keys and that is it.`
Now they managed to install the plugin in their webshop, but like I said they have no technical understanding of what webhooks are. My plugin must be idiot proof by not bothering these types of people with extra steps.
How would you go about making a plugin that takes the technical stuff out of their hands?
You as the developer will never come in touch with their system. That includes installing and configuring the plugin manually.
How would you go about making sure that the plugin creates a webhook for that person.
๐ stepping in here
koopajah had to step away
Yeah I wouldn't attempt to retrieve the endpoints every time. Mostly you want to secure your webhooks with an endpoint secret. Your plugin should enforce that a webhook secret is present. And then it should handle webhook failures.
You can go your route if you want
But as koopajah noted... I've never seen anyone attempt to do that
im not familiar with endpoint secret
tnx
ill read the resource
One more thing
Using Checkout Session it is required to create Products and Prices right?
Yes Im aware of that. But is see an issue with this
LEts say I have 5 product on my site which have no corresponding products on Stripe.
When a clients makes a purchase the cheout session will need to create a new Product/Price(s) for his items
What is the best way to prevent multiple Products from being created that are identical to each other?
For instance, lets say item A is called 'Awesomeness'.
You check upon selection of the product.
So you would list products on the account
And see if it is already present
Then you either create the product or use the returned ID
In other words when a Product is created you save the Product and Price id as metadata to the shop item
Yeah that would be a good way to do it so you don't have to retrieve each time.
That will depend on your backend and how you are storing the product data in your database.
My process is as follows:
- At checkout fetch metadata of item
- If found. retrieve item to check if it actually exists.
- if not found create a new product/price
- if no metadata is found - create new product/price
Any good?
Yep then step 5 you update the metadata of the item, right?
And you include the Stripe product/price IDs
So that you can use them on future Checkout Sessions
That is assuming you created a new product/price since none was found in step 2
Yes. I did exactly that.
Yes. It works perfectly. Just checking if my approach is something you guys would do
Oh, yeah that is a good approach in my opinion.
No issues for now. Just busy with refactoring the code
๐
You too!
Can I keep this thread open for later queries concerning the Checkout endpoint secret?
The thread will be archived after a short time but you can always pop back in the channel and ask your question and someone will be around to help!