Refunds
Create and query refunds.
Table-Specific Information
Select
The adapter uses the Shopify API to process search criteria that refer to the OrderId column. The adapter processes other filters client-side within the adapter.
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
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.
-
Calculate a refund for a line item and shipping using aggregates.
INSERT INTO Refunds(OrderId, CalculateRefund, ShippingFullRefund, LineAggregate) VALUES('123', true, true, '[{\"id\":\"123\",\"quantity\":3,\"restock_type\": \"return\",\"location_id\": \"12346\"}]')
-
Calculate a refund for a line item and shipping using temporary table.
INSERT INTO OrdersItems#Temp (ItemId, ItemQuantity) VALUES ('123', 3) INSERT INTO Refunds(OrderId, CalculateRefund, ShippingFullRefund, LineAggregate) VALUES('123', true, true, 'OrdersItems#Temp')
-
Calculate a refund for a partial amount of shipping.
INSERT INTO Refunds(OrderId, CalculateRefund, ShippingAmount) VALUES('123', true, 2.56)
-
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\":\"bogus\",\"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', 'bogus') 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 | Boolean | 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 and offer a more granular control over the tuples that are returned from the data source.
Name | Type | Description |
Notify | Boolean |
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 | Boolean |
Whether or not to to refund all remaining shipping. |
CalculateRefund | Boolean |
Set to true to simply calculate the refund but not process it The default value is false. |