#DanielDeSouza - Checkout + Shipping

1 messages · Page 1 of 1 (latest)

undone spear
#

HI 👋
I'm a little confused at the description of the flow. Can you break this down into steps?

knotty moss
#

Hi.

#

Now there is one edge case that I have considering the checkout was triggered with the wrong amount of any item in the cart.

#

But there is a shipping estimative that was created in advance at the checkout session creation that would be outdated with a smaller quantity and therefore potentially the wrong cost.

undone spear
#

Okay

  1. What do you mean "there is one edge case that I have considering the checkout was triggered with the wrong amount of any item in the cart"
#
  1. You can always disable the users ability to adjust the quantity
#

If you need to charge a different shipping rate

knotty moss
#

1 - Client added to cart 2 mugs and 1 hoodie
2 - Client clicked on Checkout button.
3 - At checkout page at stripe https://checkout.stripe.com/pay/cs_test_<***> client wants to update the quantity

So my question is how do I achieve the intended functionality without deactivating the feature quantity update at Stripe checkout?

undone spear
#

But, and correct me if I'm wrong, when the use clicks the Checkout button it triggers the creation of the Checkout Session where you pass in the shipping_options parameter.

undone spear
#

But the values you provide should not apply if the user decreases (or perhaps increases) their quantity?

knotty moss
undone spear
#

Which isn't something we currently support dynamically in the Checkout Session

#

unfortunately

knotty moss
#

Is there a way to pass a callback that calculates the shipping estimative? This would be an interesting feature to pursue in case it is not possible at the moment, I think.

undone spear
#

I think the best you could do at this point would be to listen for the checkout.session.completed event, then check the Checkout Session object to determine if the user was overcharged for shipping and process a refund.

knotty moss
#

The website is already listening to checkout.session.completed event. Sometimes items may be removed, sometimes added. Say 10 were added, then a larger box needs to be shipped. In that case, the user would actually have to pay extra for the increased shipping price.

#

I am looking at integrating the post office API to my application. That is why I am looking to tightly integrate Stripe and the post office APIs in my application in order to provide best possible service.

undone spear
#

Those nuances are going to be things you will need to determine for yourself (box size, etc.). So in that case I still think either offering refunds or perhaps using a separate auth & capture approach might work.

knotty moss
#

I would rather not increase complexity with creating an extra hold on a payment. I was wondering if I triggered the update shipping rate (the shipping rate created by the checkout session creation) when the checkout page is being displayed to the user if the new rate would be rendered automatically.

undone spear
#

If the user has already navigated to the Checkout page I do not think it would re-render the displayed Shipping Rate. But I have not tested that myself. I would want to test that to be certain

knotty moss
#

Can you test that?

#

The problem is how would my server understand if it needs to update shipping rate from stripe checkout?

#

Stripe would have to trigger a update quantity webhook to my server.

undone spear
#

Which is why I don't think that is a reasonable solution.

#

There isn't a webhook for that. That information is not communicated to Stripe until the user submits their payment info

#

In which case we fall back to providing refunds

knotty moss
#

So the most elegant solution with the present API would it be payment_intent_data.capture_method?

undone spear
#

That is how I would do it if it were me. It does add complexity to your integration but it prevents you from having to issue refunds

knotty moss
#

can you break it down the necessary steps to make this flow work with payment_intent?

undone spear
#

The doc I linked is specific to payment intents.