To create a Refund without associating it to any existing Orders

AtlTeam1
Shopify Partner
4 1 2

We are trying to migrate Products, Customers, and Historical orders to Shopify, then we'll have it create the Sales Report of total order value by vendor & by customer.

As we've successfully uploaded Products and Customer data, we are currently finding a way to properly handle historical orders data, as the historical data has two kinds of orders: "sales" and "returns".

 

What we have done:

We have imported historical sales order successfully via API (along with transaction of those orders), and the Sales Report calculates total amount as we had expected.

Now, there are two types of record in returns: ① The returns that associate with historical sales orders, and ② The returns that does not.

As we have found a way create a return order that associate with existing sales order (①), the report will show one row per order with Customer, Product, Vendor associated properly.

 

Problem:

When we create a return order that doesn't associate with previous sales order (②) via API, we just create a new order with zero price and a refund transaction, then the report will display 2 rows per order;

1st row: The row that associates with Product and its Vendor, but the return value show as zero

2nd row: The row that doesn't associate with Product or its Vendor, but it displays the return value of an order

 

Questions:

1. Is this an expected behavior?

2. Do you have any suggestion if we would like to create a return order that doesn't associated with any prior sales orders, and therefore displays only single row in reports with correct return value, and product & vendor associated?

 

 

 

Belows are what we've done so far

 

Case # ①: the body of refund transaction API request and screenshot of the report

{"refund":
  {
    "order_id": 5137000235227,
    "currency": "GBP",
    "discrepancy_reason": "customer",
    "notify": false,
    "refund_line_items":
      [
        {
        "line_item_id":12869554536667,
        "quantity":2,
        "restock_type":"no_restock"
        }
      ],
    "shipping":{"amount":0},
    "transactions":
      [
        {
        "kind":"refund",
        "status":"success",
        "amount":200,
        "gateway": "cash"
        }
      ]
  }
}

AtelierTeam1_1-1675858757376.png

 

 

Case # ② - body of order API request and screenshot of the report

{"order":
    {"line_items":
    [{
        "product_id":7959722950875,
        "variant_id":43933051388123,
        "title": "Dummy 3",
        "name": "Dummy 3",
        "price":0.00,
        "quantity":1,
        "vendor":"DummyVendor",
        "tax_lines":
        [{
            "price":0,
            "rate":0.00,
            "title":"Return tax"
        }]
    }],
    "customer": {
        "id": 6659795353819,
        "first_name": "Dummy",
        "last_name": "Cus3"
    },
    "transactions":
    [{
        "kind":"refund",
        "status":"success",
        "amount":200
    }],
    "financial_status":"paid",
    "fulfillment_status": "fulfilled",
    "currency":"GBP",
    "inventory_behaviour": "decrement_ignoring_policy",
    "test": false
    }
}

AtelierTeam1_2-1675858829567.png

 

Replies 3 (3)

CloudlabSam
Shopify Partner
555 46 91

What would be a situation where you would provide a refund that isn't related to an order?

AtlTeam1
Shopify Partner
4 1 2

We're trying to upload some historical data before starting to use shopify, and that's the data we have..

CloudlabSam
Shopify Partner
555 46 91

So it isn't associated to an order at all? Shopify doesn't have the ability to refund without it being applied to an order. So your current workaround is probably the best you can do. And yes, the reporting behavior you are seeing would be expected.