#xandert.93

1 messages · Page 1 of 1 (latest)

slim cipherBOT
cedar magnet
light condor
#

Okay! So with the first approach, the client would send the shipping rate ID in the request body? And for the second, my server fetches them from the Stripe API before applying them?

cedar magnet
#

not sure what you mean by "the client" here

light condor
#

Sorry, like my front-end codebase

hollow wasp
#

Hi! I'm taking over this thread.

#

It's only your backend code that can create the Checkout Session.

light condor
#

Hi yes I agree

#

But your friend suggested that I should store the shipping rate ID in my own database, which is accessible to both the client and server

#

As such, the client could request the shipping rates from my own DB and post their IDs to my "createCheckout" endpoint, no?

hollow wasp
light condor
#

What do you mean by "your database"?

#

Are you talking of Stripe's, or my own actual database

hollow wasp
#

This is your own database where you could store the shr_xxx ID to find them more easily, instead of having to list them with the Stripe API.

light condor
#

Okay

#

So you're suggesting that

#

Before I call stripe.checkout.sessions.create, I should make a request to my own DB for the shipping rates?

hollow wasp
light condor
#

Okay

#

This would suggest that when I create a shipping rate on Stripe, I'd need to effectively copy it into my own DB

#

At initial glance, I can't seem to find any events pertaining to ShippingRate creation

#

So, how when a ShippingRate is created, could I synchronise this with my DB?

hollow wasp
#

This would suggest that when I create a shipping rate on Stripe, I'd need to effectively copy it into my own DB
Yes, correct
At initial glance, I can't seem to find any events pertaining to ShippingRate creation
You don't need a webhook events for this, since your own code is creating the ShippingRate. So just after you create the ShippingRate, add some code to store the shr_xxx in your database.

light condor
#

Oh I see! Great thanks 🙂