I am a long ways down the path of re-implementing ...
# support
d
I am a long ways down the path of re-implementing the checkout flow in react native + stripe. I have the majority of it all figured out but one thing that I'm struggling with is the difference between the update order api (
spree.api_order_path
), and the update checkout path (
spree.api_checkout_path
). It seems that the checkout API has some limitations like if the order is on the payment step, you can't change the address and I haven't found a nice way to move the order backwards through the state machine. What is the recommended use of these APIs in a checkout flow?
m
The idea is to use the Order API for cart changes, and the checkout API for addresses, payments, shipment options etc. If you update the address or change the cart, the order should automatically go back to cart or address state (because payments depend on delivery options, which in turn depend on the shipping address). Hope this helps!
🙌🏼 1
d
That makes sense. One thing that I have not figured out is if someone has made it to the payment state, how can we rewind and let them change their address? Our setup is a bit more flexible b/c we do not ship any products
c
Have you tried just making the request to change the address through either API and see if it will reset back to the address state through https://solidus.stoplight.io/docs/solidus/8ca2e11fb528d-update-checkout or https://solidus.stoplight.io/docs/solidus/de029aabe7ec6-update-order
I can't remember how I've done this before through API, but the regular checkout controllers use this method to reset the state on changes to the cart and order addresses - https://github.com/solidusio/solidus/blob/main/core/app/models/spree/order.rb#L523-L529
Similarly any changes to the cart that go through order contents will also call this https://github.com/solidusio/solidus/blob/main/core/app/models/spree/simple_order_contents.rb#L41