【问题标题】:How to use refundCreate graphQL on Shopify?如何在 Shopify 上使用退款创建 graphQL?
【发布时间】:2020-07-22 22:50:31
【问题描述】:

我想手动退款,但出现错误。下图是当时的 GraphiQL。

[变异]

mutation refundCreate($input: RefundInput!) {
  refundCreate(input: $input) {
    order {
      id
    }
    refund {
      id
    }
    userErrors {
      field
      message
    }
  }
}

{
  "input": {
    "orderId": "gid://shopify/Order/2546480939164",
    "transactions": {
      "amount": 7,
      "gateway": "manual",
      "kind": "REFUND",
      "orderId": "gid://shopify/Order/2546480939164",
      "parentId": "gid://shopify/Order/2546480939164"
    }
  }
}

[错误]

{
{
  "data": {
    "refundCreate": null
  },
  "errors": [
    {
      "message": "invalid id",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "refundCreate"
      ]
    }
  ],
  "extensions": {
    "cost": {
      "requestedQueryCost": 20,
      "actualQueryCost": 0,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 1000,
        "restoreRate": 50
      }
    }
  }
}

以下是我要退款的订单信息。

        {
          "node": {
            "id": "gid://shopify/Order/2546480939164",
            "customer": {
              "id": "gid://shopify/Customer/3750294814876",
              "firstName": "Hiroshi",
              "lastName": "Ueda",
              "phone": null
            },
            "name": "#1002",
            "refunds": [],
            "lineItems": {
              "edges": [
                {
                  "node": {
                    "id": "gid://shopify/LineItem/5637576818844",
                    "sku": "CK0102",
                    "name": "Chicken LEG Meat Skin-on",
                    "quantity": 1,
                    "refundableQuantity": 1,
                    "requiresShipping": false,
                    "image": {
                      "id": "gid://shopify/ImageSource/9771770806428",
                      "originalSrc": "https://cdn.shopify.com/s/files/1/0417/0262/1340/products/ChickenLegMeat_Skin-on.jpg?v=1593188882"
                    },
                    "product": null
                  }
                },
                {
                  "node": {
                    "id": "gid://shopify/LineItem/5637576851612",
                    "sku": "CK0101",
                    "name": "Chicken LEG Meat Skinless",
                    "quantity": 1,
                    "refundableQuantity": 1,
                    "requiresShipping": false,
                    "image": {
                      "id": "gid://shopify/ImageSource/9771771265180",
                      "originalSrc": "https://cdn.shopify.com/s/files/1/0417/0262/1340/products/ChickenLegMeat_Skinless.jpg?v=1593188883"
                    },
                    "product": null
                  }
                }
              ]
            }
          }
        }

当我删除 parent_id 时,我又收到了类似这样的错误。

“不在 'store-credit'、'exchange-credit' 或 'cash' 网关上的交易需要 parent_id”。

你们有样品要退款吗?

【问题讨论】:

    标签: graphql shopify


    【解决方案1】:

    我解决了。

    我设置了"gateway": "exchange-credit", 而不是parent_id。

    谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-13
      • 2019-11-21
      • 1970-01-01
      • 2021-10-22
      • 2021-06-18
      • 2021-06-27
      • 1970-01-01
      相关资源
      最近更新 更多