【问题标题】:Shopify API Partial Refund On Order Through Transaction Using PHPShopify API 通过使用 PHP 进行交易的订单部分退款
【发布时间】:2012-07-18 16:47:41
【问题描述】:

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

问题: Shopify API - 通过创建新交易对订单进行部分退款(反对简单地取消订单)

原因:在不取消订单的情况下给予客户部分退款

问题: 将'Create Transaction'发送到shopify api时查询崩溃,没有错误,try和catch没有启动,查询到shopify后的代码被忽略也是。

用于交易的 Shopify Developer API XML/JSON: 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
?>

【问题讨论】:

  • 您能否澄清“未启动尝试和捕获”的意思?如果响应代码 >=400,shopify.php 将引发异常。您需要围绕 POST 请求的 try/catch 块,上面的代码 sn-p 中似乎缺少该块。

标签: php api shopify


【解决方案1】:

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

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

【讨论】:

  • 令人失望,但同样感谢 DenisOdorcic。我相信我只是被“交易描述”中的注释弄糊涂了:...有五种交易类型:授权、销售、捕获、作废和退款...退款只能在捕获处理后发生并且是将捕获的资金部分或全部退还给持卡人。
猜你喜欢
  • 1970-01-01
  • 2019-08-31
  • 2020-06-16
  • 2014-09-01
  • 1970-01-01
  • 2018-04-08
  • 2022-01-23
  • 2014-01-12
  • 2015-09-21
相关资源
最近更新 更多