Trying to create an order transaction to mark the order as paid but I get an error

Solved
lcs02_Admin
Tourist
9 0 0

Hi its me again with a question:

I am trying to create an order transaction to mark the order as paid but I get an error.

I used this endpoint

/admin/api/2020-04/orders/2266686619725/transactions.json

And the body was

{
"transaction": {
"currency": "USD",
"amount": "67.19",
"kind": "capture",
"parent_id": 2865785241677,
"status": "success"
}
}

 

I got this response {"errors": {"base": ["Can only capture successful authorizations"]}}

I hope you can help me

X-Request-Id a3440e73-372d-4651-bfb0-c78309795294

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 163

This is an accepted solution.

Hey @lcs02_Admin,

 

You can only create a transaction with kind capture when an existing transaction is present with kind authorization.

 

If you're looking to create a manual transaction, use the kind sale and include a source field with value external. A call could look something like this:

 

POST /admin/api/2020-04/orders/#{order_id}/transactions.json

{
  "transaction": {
    "currency": "USD",
    "amount": "10.00",
    "kind": "sale",
    "source": "external"
  }
}

 

JB | Developer Support @ 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

lcs02_Admin
Tourist
9 0 0

Thanks a lot!!

0 Likes