Refunds
Create and query refunds.
Table-Specific Information
Select
The cmdlet uses the Shopify API to process search criteria that refer to the OrderId column. The cmdlet processes other filters client-side within the cmdlet.For example, the following queries are processed server-side.
If you specify the unique identifier of the Order, then this view will only list refund information concerning that order.
SELECT * FROM Refunds WHERE OrderId = '179098550295'
SELECT * FROM Refunds WHERE OrderId = '179098550295' AND Id = '7382073367'
Insert
You must specify the OrderId when inserting a refund.
-
Create a new refund for an order using aggregates.
INSERT INTO Refunds (OrderId, Restock, Notify, Note, ShippingFullRefund, LineAggregate) VALUES ('123', true, true, 'Wrong size', true, '[{\"id\":\"123\",\"quantity\":3,\"restock_type\": \"return\"}]')
-
Create a new refund for an order using temporary table.
INSERT INTO OrdersItems#TEMP (ItemId, ItemQuantity) VALUES ('123', 3) INSERT INTO Refunds (OrderId, Restock, Notify, Note, ShippingFullRefund, LineAggregate) VALUES ('123', true, true, 'Wrong size', true, 'OrdersItems#TEMP')
-
Create a new refund for an order and attach a transaction to the refund as well using aggregates.
INSERT INTO Refunds (OrderId, LineAggregate, OrderTransactionAggregate) VALUES ('123', '[{\"id\":\"123\",\"quantity\":3,\"restock_type\": \"return\"}]', '[{\"kind\":\"refund\",\"amount\":5.5,\"gateway\":\"gw\",\"parent_id\":\"789\"}]')
-
Create a new refund for an order and attach a transaction to the refund as well using temporary table.
INSERT INTO OrdersItems#TEMP (ItemId, ItemQuantity) VALUES ('123', 3) INSERT INTO Transactions#TEMP (TransactionItemParentId, TransactionItemAmount, TransactionItemKind, TransactionItemGateway) VALUES ('789', 5.5, 'refund', 'gw') INSERT INTO Refunds (OrderId, LineAggregate, OrderTransactionAggregate) VALUES ('123', 'OrdersItems#TEMP', 'Transactions#TEMP')
-
Refund a specific amount of shipping using aggregates.
INSERT INTO Refunds (OrderId, ShippingAmount, OrderTransactionAggregate) VALUES ('123', 5.3, '[{\"parent_id\":\"456\"}]')
-
Refund a specific amount of shipping using temporary table.
INSERT INTO Transactions#TEMP (TransactionItemParentId) VALUES ('456') INSERT INTO Refunds (OrderId, ShippingAmount, OrderTransactionAggregate) VALUES ('123', 5.3, 'Transactions#TEMP')
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | Long | True |
The unique identifier for the refund. | |
OrderId | Long | False |
Orders.Id |
The id of the order. |
OrderUpdatedAt | Datetime | True |
Orders.UpdatedAt |
The date and time when the order was last modified. |
Note | String | False |
The optional note attached to a refund. | |
Restock | Bool | True |
Whether or not the line items were added back to the store inventory. | |
UserId | Long | True |
The unique identifier of the user who performed the refund. | |
CreatedAt | Datetime | True |
The date and time when the refund was created. | |
ProcessedAt | Datetime | True |
The date and time when the refund was imported. | |
LineAggregate | String | False |
A JSON aggregate of line items associated with the refund. | |
OrderTransactionAggregate | String | False |
A JSON aggregate of transactions associated with the refund. |
Pseudo-Columns
Pseudo column fields are used in the WHERE clause of SELECT statements, to offer a more granular control over the tuples that are returned from the data source, or as parameters in INSERT statements.
Name | Type | Description |
Notify | Bool |
Whether or not to send a refund notification to the customer. |
DiscrepancyReason | String |
An optional comment, used if there is a discrepancy between calculated and actual refund amounts (one of: restock, damage, customer, other) |
ShippingAmount | Decimal |
Set specific amount of shipping to refund. Takes precedence over FullRefund. |
ShippingFullRefund | Bool |
Whether or not to to refund all remaining shipping. |