Adding Transactions via API to POS pending orders or Admin created Orders (not drafts).

asmerkin
Shopify Partner
15 1 1

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?

Thank you!

Reply 1 (1)
Liam
Shopify Staff
Shopify Staff
1868 196 572

Hi Asmerkin,

 

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:

  1. Use the API to fetch the details of the order created via POS or admin.
  2. Create a new order via the API with the same details and an authorized financial status.
  3. Attach transactions to this new order as needed.
  4. 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!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog