使用PHP通过事务订购Shopify API部分退款

时间:2012-07-18 16:47:41

标签: php api shopify

(我是第一次发布海报,请原谅我缺乏正确的格式,如果这个问题已经以某种形式或方式得到了回答)

问题:Shopify API - 通过创建新交易订购部分退款(与简单取消订单相反)

原因:在不取消订单的情况下向客户提供部分退款

问题:查询在将“创建交易”发送到shopify api时崩溃,没有错误,尝试和捕获没有启动,并且查询shopify之后的代码被忽略同样。

Shopify Developer API XML / JSON for Transactions: http://api.shopify.com/transactions.html

目前正在使用Sandeepsheety的PHP API代码: https://github.com/sandeepshetty/shopify.php/blob/master/README.md

<?php
//-------------------------------------------------------------------------------
//PHP Code Begins
//NOTE: [Does return correct values for the Order through GET through id=135264996 and,
// transaction GET data is verified as well - Test Order Total = $94.50 and,
// tested a few other orders ids with the same result.]
//-------------------------------------------------------------------------------

       //Does connect and I have verified with a few GETS and even a couple cancellations
        $shopify = shopify_api_client($SHOPIFY_STORE_URL, NULL, $SHOPIFY_API_KEY, $SHOPIFY_TOKEN, true);

       //Based on Create Transactions: (POST /admin/orders/#{id}/transactions.json)
        $jsonURL= "/admin/orders/135264996/transactions.json";

        $query = $shopify('POST', $jsonURL, array('kind'='refund', 'amount'=10));
       //NOTHING HAPPENS and Code Stops HERE

        echo "Passed";  //IGNORED
?>

1 个答案:

答案 0 :(得分:4)

Transaction API仅支持'capture'作为种类。服务器返回403 Forbidden,文本“目前仅支持捕获”。

shopify.php不能正确处理该错误,但这是您遇到的问题。