Improve payment gateway API : allow sending order number instead of order id
Some payment gateway like Atos request an order id to identify the order so that you can match the bank account logs with your ERP.
It is highly recommended to use a custom order number and not the native Woocommerce unique order id. One good reason is that one seller can have multiple e-commerce websites (multiple Woocommerce or other platforms) but share the same bank account. If you don’t want to have duplicate order ids in your bank logs, you need to customize them and, unfortunately, a plugin is required for that (despite the fact that the “number” field” is native in Woocommerce).
As the number is registered as a meta value in database, it allows duplicate values so you can not be sure to retrieve the unique order id from the number value. The only way to avoid duplicate is to filter on the meta_key that is specific to the plugin. So there is no “universal” way to retrieve the unique order id from the order number and the implementation depends on the plugin.
That’s why the plugin I use is sending the order id to Atos because the plugin needs this id to update the order after payment and the developer can not add specific code for each plugin (in my case “custom order numbers” but another one is” Sequential Order Numbers Pro”).
Is there a way that in the future Woocommerce allows natively a unique and universal order number and an API to get the order id corresponding ? (Note that it is the case in Magento).
If not, how to avoid this problem ? I believe that paypal is using session for storing id but I believe it is not recommended by Atos : the id is sent back in a hash by the gateway response and the gateway dos not provide a second field.