我遇到了一个我自己无法处理的问题。我想通过应用程序在Shopfiy中更改订单的Paymnent状态。Shopify 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)数组('base'=
API中是否有任何更改?有人能帮忙吗?谢谢,安德鲁
尝试将事务创建为订单数组的一部分。
$orders['order']['transactions'][] = array(
'amount' => $tran->amount,
'kind' => $tran->kind,
'status' => $tran->status,
'source_name'=> 'other'
);
为我工作。