我遇到了一個我自己無法處理的問題。我想通過應用程序更改Shopfiy中訂單的付款狀態。該Shopify API文檔描述清楚如何爲「支付」標誌的現有事務:https://help.shopify.com/api/reference/transaction#createShopify API交易 - 「找不到可捕獲的交易」
我所做的一切,因爲它是寫的,但我收到一條錯誤消息: 「沒有可捕捉的交易被發現」
奇怪的是,在我們之前創建的另一個應用程序中使用完全相同的代碼。
$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());
}
響應我接收:
phpish \ shopify \ ApiException:[422]處理的實體(https://proda-hu.myshopify.com/admin/orders/3264737735/transactions.json)陣列( '基地'=>數組(0 =>「沒有可捕獲交易被發現'),)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 ] =>陣列([0] =>沒有可捕獲的交易被發現)))
API中的任何內容可能已被更改?誰能幫忙?謝謝,安德魯