I'm working on a solution that requires the creation of new transactions to orders created via POS or admin, but these are not draft orders. The financial status is pending, but since I don't have an authorization transaction, I can't capture a payment because I don't have a parent_id.
Besides, I can't create new authorization or sale transactions because the API doesn't allow it.
I know I can attach transactions to orders I created via API, but I need to attach transactions to orders created by admin or POS. How can I achieve that using REST or GraphQL APIs?
Creating transactions for orders that were not initially created via the API, especially those from POS or the admin, can be a bit tricky due to the constraints of the Shopify API. here's a couple considerations you can explore:
1. Change Order Financial Status: If you have control over the order creation process, consider creating orders with a financial status of authorized instead of pending. This would allow you to capture payments later. However, this might not be feasible if you're dealing with orders that have already been created.
2. Recreate the Order: A more complex workaround involves the following steps:
Use the API to fetch the details of the order created via POS or admin.
Create a new order via the API with the same details and an authorized financial status.
Attach transactions to this new order as needed.
Cancel or archive the original order to avoid duplication.
This approach might not be ideal for all scenarios, especially if there are many orders to process though.
3. External Payment Gateway: If you're using an external payment gateway, you might be able to handle authorizations and captures outside of Shopify and then update the order status in Shopify to reflect the payment status. This would involve more integration work with the payment gateway's API.
I'd recommend exploring these options to see if they could work for your usecase!