#bear-localhost-ip

1 messages ยท Page 1 of 1 (latest)

nova python
#

Hello! what do you mean by "require an endpoint when initiation Stripe"? Do you have more context around your ask?

open folio
#

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

nova python
#

I don't understand I'ms orry

#

what does "all websites need an endpoint"

nova python
#

@open folio any update?

open folio
#

Yes. Im talking about Webhooks.

#

All websites integrating Stripe should have a Webhook registered, right?

nova python
#

kind of

open folio
#

Yes Im already doing that

nova python
#

then there's nothing to register at all

open folio
#

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.

nova python
#

that doesn't make sense to do at all honestly

open folio
#

How so?

nova python
#

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

open folio
#

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.

misty brook
#

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

open folio
#

im not familiar with endpoint secret

open folio
#

tnx

#

ill read the resource

#

One more thing

#

Using Checkout Session it is required to create Products and Prices right?

misty brook
#

Yes

#

Though you can create them inline if you want

open folio
#

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'.

misty brook
#

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

open folio
#

In other words when a Product is created you save the Product and Price id as metadata to the shop item

misty brook
#

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.

open folio
#

My process is as follows:

#
  1. At checkout fetch metadata of item
#
  1. If found. retrieve item to check if it actually exists.
#
  1. if not found create a new product/price
#
  1. if no metadata is found - create new product/price
#

Any good?

misty brook
#

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

open folio
#

Yes. I did exactly that.

misty brook
#

Cool then that should work, right?

#

Are you running into issue?

open folio
#

Yes. It works perfectly. Just checking if my approach is something you guys would do

misty brook
#

Oh, yeah that is a good approach in my opinion.

open folio
#

No issues for now. Just busy with refactoring the code

misty brook
#

๐Ÿ‘

open folio
#

Thank you for now.

#

Have a good day.

misty brook
#

You too!

open folio
#

Can I keep this thread open for later queries concerning the Checkout endpoint secret?

misty brook
#

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!