I built a custom app using checkout UI extension to implement loyalty points.
I saved loyalty points in customer’s metafield. And when customer use this point to their order, i used Shopify Flow to minus the points they used.
But have a delay about 5 seconds to customer’s metafield was updated.
And in the delay time, if customer use 2 devices, and use maximum loyalty points, they click pay button as the same time, they still checkout successfully. It means loyalty points was doubled. This is a very large risk, right?
So i want to know how can I update the customer metafield immediately once checkout successfully?
Please help me.
Thank in advance.