How can I generate the Checkout URL for existing Order

Hi,

I want to generate the Checkout URL for existing Order. When I see the Checkout API, it is always asking to create an new Order (fill location_id, item details). Is there anyway to pass the existing Order Id to get the Checkout URL for that?

Thank you in advance.

Sannith

:wave: Currently, there isn’t a way to pass an existing order to the Checkout API to create the checkout_url. If you are first using CalculateOrder with your customer throughout the checkout experience you can then create the order with the CreateCheckout request at the end of the checkout experience. :slightly_smiling_face:

:wave: Just curious if this is still the case? We use draft orders that get updated as the user builds their cart, and our current plan is to duplicate the order using the checkouts api. We’d much rather just take the order out of draft and pay for it.

Thanks in advance :heart:

Hey @mtwichel! Yes, with the new CreatePaymentLink endpoint you can now create a checkout using an order. There’s documentation on that here.

Thanks for that Josh! Just so I fully understand, can we pass an existing orderId into that endpoint to create the checkout link? In the example you linked it looked like they were creating a new order with line items and other stuff. Thanks!

Currently, a pre-existing order cannot be used with CreatePaymentLink — a new order needs to be defined for the link.

For our own reference though, I’m curious to know more about your use case! Is this mostly about ease of integration with the order creation logic that already exists in your app?

Is this mostly about ease of integration with the order creation logic that already exists in your app?

Exactly! It’s actually for the last bit of our hackathon entry :sunglasses: I’d be happy to jump on the phone to share the use case if you’d like!

Oh awesome, glad to hear you’re participating in it! I’ll shoot you a DM :grin:

@josh-square Currently in the same boat exploring how to pay for an order that I update as the user adds and removes cart items. Wondering how this was resolved in the end?

Any order CreatePaymentLink generates can be updated with UpdateOrder. You can add or remove line items accordingly before redirecting the customer to the checkout page. :slightly_smiling_face: