Marketplaces / Shopify as Marketplace / ShopifyV2 Technical Scope / Shopify Order Management / Shopify Refund Orders

Shopify Refund Orders

Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)

Version Date Created / Updated Notes
v1.0 Hristiyan First publish

API Docs : https://shopify.dev/docs/api/admin-rest/2024-01/resources/refund#post-orders-order-id-refunds

API Call : POST /admin/api/2024-01/orders/{{orderID}}/refunds.json

The {{orderID}} is mapped to Orders > Marketplace Order ID .

All triggers, validations etc. are as per our refunds abstraction - https://www.notion.so/threecolts/Refunds-send-general-logic-d643578dd9364d4faea0198cab5aa38e

The response is in a JSON format

HTTP/1.1 201 Created
{
  "refund": {
    "id": 929361466,
    "order_id": 450789469,
    "created_at": "2024-01-02T09:01:02-05:00",
    "note": "wrong size",
    "user_id": null,
    "processed_at": "2024-01-02T09:01:02-05:00",
    "restock": false,
    "duties": [],
    "total_duties_set": {
      "shop_money": {
        "amount": "0.00",
        "currency_code": "USD"
      },
      "presentment_money": {
        "amount": "0.00",
        "currency_code": "USD"
      }
    },
    "additional_fees": [],
    "total_additional_fees_set": {
      "shop_money": {
        "amount": "0.00",
        "currency_code": "USD"
      },
      "presentment_money": {
        "amount": "0.00",
        "currency_code": "USD"
      }
    },
    "return": null,
    "admin_graphql_api_id": "gid://shopify/Refund/929361466",
    "refund_line_items": [
      {
        "location_id": null,
        "restock_type": "no_restock",
        "quantity": 1,
        "id": 1058498311,
        "line_item_id": 518995019,
        "subtotal": 0,
        "total_tax": 0,
        "subtotal_set": {
          "shop_money": {
            "amount": "0.00",
            "currency_code": "USD"
          },
          "presentment_money": {
            "amount": "0.00",
            "currency_code": "USD"
          }
        },
        "total_tax_set": {
          "shop_money": {
            "amount": "0.00",
            "currency_code": "USD"
          },
          "presentment_money": {
            "amount": "0.00",
            "currency_code": "USD"
          }
        },
        "line_item": {
          "id": 518995019,
          "variant_id": 49148385,
          "title": "IPod Nano - 8gb",
          "quantity": 1,
          "sku": "IPOD2008RED",
          "variant_title": "red",
          "vendor": null,
          "fulfillment_service": "manual",
          "product_id": 632910392,
          "requires_shipping": true,
          "taxable": true,
          "gift_card": false,
          "name": "IPod Nano - 8gb - red",
          "variant_inventory_management": "shopify",
          "properties": [],
          "product_exists": true,
          "fulfillable_quantity": 1,
          "grams": 200,
          "price": "199.00",
          "total_discount": "0.00",
          "fulfillment_status": null,
          "price_set": {
            "shop_money": {
              "amount": "199.00",
              "currency_code": "USD"
            },
            "presentment_money": {
              "amount": "199.00",
              "currency_code": "USD"
            }
          },
          "total_discount_set": {
            "shop_money": {
              "amount": "0.00",
              "currency_code": "USD"
            },
            "presentment_money": {
              "amount": "0.00",
              "currency_code": "USD"
            }
          },
          "discount_allocations": [
            {
              "amount": "3.33",
              "discount_application_index": 0,
              "amount_set": {
                "shop_money": {
                  "amount": "3.33",
                  "currency_code": "USD"
                },
                "presentment_money": {
                  "amount": "3.33",
                  "currency_code": "USD"
                }
              }
            }
          ],
          "duties": [],
          "admin_graphql_api_id": "gid://shopify/LineItem/518995019",
          "tax_lines": [
            {
              "title": "State Tax",
              "price": "3.98",
              "rate": 0.06,
              "channel_liable": null,
              "price_set": {
                "shop_money": {
                  "amount": "3.98",
                  "currency_code": "USD"
                },
                "presentment_money": {
                  "amount": "3.98",
                  "currency_code": "USD"
                }
              }
            }
          ]
        }
      }
    ],
    "transactions": [
      {
        "id": 1068278483,
        "order_id": 450789469,
        "kind": "refund",
        "gateway": "bogus",
        "status": "success",
        "message": "Bogus Gateway: Forced success",
        "created_at": "2024-01-02T09:01:02-05:00",
        "test": true,
        "authorization": null,
        "location_id": null,
        "user_id": null,
        "parent_id": 801038806,
        "processed_at": "2024-01-02T09:01:02-05:00",
        "device_id": null,
        "error_code": null,
        "source_name": "755357713",
        "receipt": {},
        "amount": "41.94",
        "currency": "USD",
        "payment_id": "c901414060.1",
        "total_unsettled_set": {
          "presentment_money": {
            "amount": "348.0",
            "currency": "USD"
          },
          "shop_money": {
            "amount": "348.0",
            "currency": "USD"
          }
        },
        "manual_payment_gateway": false,
        "admin_graphql_api_id": "gid://shopify/OrderTransaction/1068278483"
      }
    ],
    "order_adjustments": []
  }
}

From the response mapping we only need to store the ID of the refund and this needs to be done in Order Payment > Transaction ID

Is this article helpful?
0 0 0