I ran into an issue that I can not handle by myself. I want to change the paymnent status of an order in Shopfiy through an App. The Shopify API documentation describes it clearly how to mark an existing transaction as "paid": https://help.shopify.com/api/reference/transaction#create
I did everything as it is written, but I'm getting an error message: "No capturable transaction was found"
The strange thing is that the exact same code used to work in another App that we created before.
$shopify = shopify\client($stores[$order['storeID']]['shop'], SHOPIFY_APP_API_KEY, $stores[$order['storeID']]['oauth_token']);
try
{
# Making an API request can throw an exception
$transactions = $shopify('POST /admin/orders/'.$order['order_id'].'/transactions.json', array(), array
(
'transaction' => array
(
"amount" => $order['cod_amount_received'],
"kind" => "capture"
)
));
print_r($transactions);
}
catch (shopify\ApiException $e)
{
# HTTP status code was >= 400 or response contained the key 'errors'
echo $e;
print_r($e->getRequest());
print_r($e->getResponse());
}
catch (shopify\CurlException $e)
{
# cURL error
echo $e;
print_r($e->getRequest());
print_r($e->getResponse());
}
The response I receive:
phpish\shopify\ApiException: [422] Unprocessable Entity (https://proda-hu.myshopify.com/admin/orders/3264737735/transactions.json) array ( 'base' => array ( 0 => 'No capturable transaction was found', ), ) in /chroot/home/onlinema/webshippy.com/html/app/syncback_shopify.php on line 98Array ( [method] => POST [uri] => https://proda-hu.myshopify.com/admin/orders/3264737735/transactions.json [query] => Array ( ) [headers] => Array ( [X-Shopify-Access-Token] => 37c97637d737cf7ac8d8784d3d8ba7fd [content-type] => application/json; charset=utf-8 ) [payload] => Array ( [transaction] => Array ( [amount] => 5980.00 [kind] => capture ) ) ) Array ( [errors] => Array ( [base] => Array ( [0] => No capturable transaction was found ) ) )
Anything has been changed in the API maybe? Can anyone help? Thanks, Andrew