Shopify Refund Order Line Items and Shipping Fee v2
Refund the full order or specific items, together with shipping fee or a part of it based on line items that are refunded
In order for this action to work 3 meta object definitions have to be created for the Shopify store.
Inputs
Name | Type | Description |
---|---|---|
Shopify Token | Credentials | Shopify API token |
Shopify Domain | String | Shopify domain |
Order ID | String | Shopify order ID |
Line Items | Optional List | Shopify line items to be refunded. Default: All line items |
Refund Only Shipping? | Optional Boolean | Whether to refund only the shipping fee. Linked to: Shipping Refund Type. Default: false |
Refund Reason | String | Refund reason that will be added to the order notes |
Only Calculate Refund | Optional Boolean | Whether to only calculate the refund and not actually perform it. Default: false |
Restock Type | Optional String | Restock type for the line items. Default: no_restock Possible values: no_restock, cancel, return |
Shipping Refund Type | Optional String | Type of refund for the shipping fee. Default: Depending on the line items Possible values: full, partial, none |
Partial Shipping Refund Criteria | Optional String | Criteria on which to calculate the partial shipping fee refund. Default: quantity Possible values: quantity, weight |
Update Order Note | Optional Boolean | Whether to update the order note with the refund reason. Default: true |
Max Refund Amount | Optional Number | Max refund amount for one transaction |
Check for Previous Refunds | Optional Boolean | Whether to check for previous refunds for the order customer. Default: true |
Check Universal Limits | Optional Boolean | Whether to check for domain wide number of refunds during last hour, 12 hours and 24 hours. Default: true |
Check Universal Amount Limits | Optional Boolean | Whether to check amount refunded in the last 24 hours. Linked to: Check Universal Limits. Default: false |
Check for Fraud Limits | Optional Boolean | Whether to check for shipping/billing addresses and card details limits. Default: false |
Send Notifications to DG Slack channel | Optional Boolean | Whether to send notifications to the DG Slack channel if the universal limits were exceeded. Default: false |
Fraud Records Limit | Optional Number | Limit for refunds created for address/card number/card name. Linked to: Check for Fraud Limits. Default: 1 |
Fraud Addresses Limit | Optional Number | Limit for refunds created from different addresses for a specific zip code. Linked to: Check for Fraud Limits. Default: 5 |
Hour Limit | Optional Number | Hour limit for refunds created. Linked to: Check Universal Limits. Default: 10 |
Twelve Hour Limit | Optional Number | Twelve hour limit for refunds created. Linked to: Check Universal Limits. Default: 30 |
Twenty Four Hour Limit | Optional Number | Twenty four hour limit for refunds created. Linked to: Check Universal Limits. Default: 50 |
Twenty Four Hour Amount Limit | Optional Number | Twenty four hour amount limit for refunds created. Linked to: Check Universal Amount Limits. Default: 2000 |
Restock Type
How this refund line item affects inventory levels.
no_restock: Refunding these items won't affect inventory.
cancel: The items have not yet been fulfilled. The canceled quantity will be added back to the available count. The number of fulfillable units for this line item will decrease.
return: The items were already delivered but will be returned to the merchant. The returned quantity will be added back to the available count. The number of fulfillable units for this line item will remain unchanged.
Refund Only Shipping
Default value: false
When this option is enabled (true), the action will perform a refund only for the shipping fee.
The fee is calculated based on the Shipping Refund Type and the Line Items.In case the Shipping Refund Type is not provided and the Line Items are provided, the shipping fee will be calculated based on the quantity of items.
Shipping Refund Type
How the shipping fee refund will be calculated.
full: The shipping fee will be refunded fully.
partial: The shipping fee refund will be calculate based on the quantity or weight of the line items that are being refunded.none: The shipping fee will not be refunded.
Partial Shipping Refund Criteria
How the partial shipping fee refund will be calculated.
quantity: The percentage of refundable items quantity divided by the total quantity.
weight: The percentage of refundable items weight divided by the total weight.
Check for Previous Refunds
Default value:
true
When this option is enabled, the action will perform the following logic:
- Retrieve the last (max 100) orders for the customer.
- Check if any of these orders have a meta field created by DG.
- If a meta field with the refund key is found, the order creation process will be stopped.
Check Universal Limits
Default value:
true
When this option is enabled, the action will perform the following logic:
- Query meta objects of type
$app:refund_replacement_order
.- Check the number of filtered meta objects by time against the following limits:
- Hour Limit: 10
- Twelve Hour Limit: 30
- Twenty-Four Hour Limit: 50
- If any of these limits are exceeded, the refund process will be stopped.
Additionally, if Check Universal Amount Limits is enabled, the action will check the total amount of money refunded within the twenty-four hour limit against the Twenty Four Hour Amount Limit (default value: 2000). If this amount is exceeded, the refund process will be stopped.
Check for Fraud Limits
Default value:
false
When this option is enabled, the action will perform the following logic:
- Search for meta objects of type
$app:refund_replacement_address
using the shipping address zip code and the billing address zip code. If records are found, the system will check against the following limits:
- Fraud Records Limit: 1
- Fraud Addresses Limit: 5
The Fraud Addresses Limit is used to check how many distinct address lines are tied to the same zip code. If either of these limits is exceeded, therefund process will be stopped.
- Search for meta objects of type
$app:refund_replacement_card_details
using the card type, the last 4 digits of the card, and the cardholder's name. If records are found, the system will check against theFraud Records Limit
(default value: 1). If this limit is exceeded, the refund process will be stopped.
Send Notifications to DG Slack channel
Default value:
false
When this option is enabled, the action will perform the following logic:
If the universal limits are exceeded, a notification will be sent to the
#shopify_r_r_alarms
DG Slack channel.
Hour Limit, Twelve Hour Limit, Twenty Four Hour Limit, Twenty Four Hour Amount Limit, Fraud Records Limit, Fraud Addresses Limit
These are optional inputs, each of which has a default value. They will be considered only if the inputs that they are linked with are truthful.
Hour Limit: 10
Twelve Hour Limit: 30
Twenty Four Hour Limit: 50
Fraud Records Limit: 1
Fraud Addresses Limit: 5
Outputs
Name | Type | Description |
---|---|---|
Refund Successful | Boolean | Whether the refund was created/calculated successfully |
Calculate Refund Only | Boolean | Whether to only calculate the refund and not actually process the refund |
Blocked by Safety Checks | Boolean | Whether the refund was blocked by safety/fraud checks |
Refund Metafields Created | Boolean | Whether the refund metafields were created |
Refund Metaobject Created | Boolean | Whether the refund metaobject was created |
Fraud Prevention Meta Objects Created | Boolean | Whether the fraud prevention addresses/card details meta objects were created |
Refund Meta Object Updated | Boolean | Whether the refund meta object was updated after the order was created |
Refund Details | Object | Refund details object returned by Shopify |
Refund String | String | Refund amount and currency |
Refund
A refund processes only if all the safety checks are passed and the initial refund meta object is created.
Refund Meta Object Schema
mutation {
metaobjectDefinitionCreate(
definition: {
type: "$app:refund_replacement_order"
access: { admin: MERCHANT_READ, storefront: NONE }
fieldDefinitions: [
{ key: "order_id", name: "Order ID", type: "number_integer" }
{ key: "status", name: "Status", type: "single_line_text_field" }
{ key: "completed", name: "Operation Completed?", type: "boolean" }
{ key: "start_date", name: "Date and Time Refund/Replacement Initiated", type: "date_time" }
{ key: "reason", name: "Reason for refund/replacement", type: "single_line_text_field" }
{ key: "amount", name: "Amount refunded/replaced", type: "number_integer" }
{ key: "customer_id", name: "Shopify Customer ID", type: "number_integer" }
{ key: "customer_email", name: "Customer Email", type: "single_line_text_field" }
{ key: "shipping_address_zip", name: "Shipping Address ZIP Code", type: "single_line_text_field" }
{ key: "billing_address_zip", name: "Billing Address ZIP Code", type: "single_line_text_field" }
{ key: "ip_address", name: "Order IP Address", type: "single_line_text_field" }
{ key: "operation_type", name: "Operation Type: Refund or Replacement", type: "single_line_text_field" }
{ key: "type", name: "Type: Full or Partial", type: "single_line_text_field" }
{ key: "shipping_address", name: "Shipping Address", type: "json" }
{ key: "billing_address", name: "Billing Address", type: "json" }
{ key: "line_items", name: "Line Items", type: "json" }
]
}
) {
metaobjectDefinition {
id
type
fieldDefinitions {
key
name
type {
name
}
}
}
}
}
Addresses Meta Object Schema
mutation {
metaobjectDefinitionCreate(
definition: {
type: "$app:refund_replacement_address"
access: { admin: MERCHANT_READ, storefront: NONE }
fieldDefinitions: [
{ key: "address_list", name: "List of Addresses", type: "json" }
]
}
) {
metaobjectDefinition {
id
type
fieldDefinitions {
key
name
type {
name
}
}
}
}
}
Card Details Meta Object Schema
mutation {
metaobjectDefinitionCreate(
definition: {
type: "$app:refund_replacement_card_details"
access: { admin: MERCHANT_READ, storefront: NONE }
fieldDefinitions: [
{ key: "count", name: "Number of Operations", type: "json" }
]
}
) {
metaobjectDefinition {
id
type
fieldDefinitions {
key
name
type {
name
}
}
}
}
}
Updated about 1 month ago