I am using the JS SDK to build shopify presence on my website.
I figured how to build my own cart and open a checkout, submit line items and launch the checkout in a new web-browser.
My question is - how do i detect that an order was completed?
I see that there's an 'order' field in checkout - but do I have to keep polling this variable to figure out when/if a checkout completed or is there some sort of event that i can trap?
I did notice that the checkout session pointed to by "webUrl" seems to send messages back to the window that called it which i can trap via window.onmessage() but i haven't figured out what these messages mean and if any of them flag that an order was complete.
Any help gratefully accepted