The moment it happens
Log Shopify refunds to Google Sheets
Each Shopify refund is added to a Refunds tab with the order number, refunded items, amount and note as soon as it is issued.
- Runs
- The moment it happens
- Apps
- Google Sheets, Shopify
- AI
- Not needed
- Access
- read_orders; Google Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: when a refund is issued in Shopify, add a row to the Refunds tab of my sheet with the date, order number, refunded items and quantities, amount refunded, whether items were restocked and the refund note.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Refunds hit the margin directly, but in Shopify they are spread across individual orders. Answering "how much did we refund last month, and for which products?" means opening orders one at a time or building a report.
This automation writes every refund to a sheet the moment it is issued, with the order number, the items and quantities, the amount, whether stock went back, and the staff note.
Store owners, customer service leads and bookkeepers use the tab to spot problem products and to book refunds correctly.
What you get out of it
Problem products show up
Count refunds by item to see which products come back most.
Monthly refund totals
Sum the amount column per month for the books.
Restock decisions recorded
See which refunds returned items to stock and which were write-offs.
Staff notes kept
The refund note explains why money went back, without opening the order.
Verified source
Only webhooks signed by your store are accepted.
How it works
What happens, step by step
You add a ClickRuntime trigger link as a Shopify webhook for refunds.
When a refund is issued, Shopify sends it and ClickRuntime checks it really came from your store.
ClickRuntime reads the refunded items, amount, restock choice and note, and looks up the order number.
A row is added to your Refunds tab.
Before it runs live
- Connect your Google Sheets account and pick the spreadsheets it may use
- Connect Shopify
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Google Sheets and Shopify steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import base64, hashlib, hmac
from clickruntime import on_event, credentials, http, state
STORE = "your-store.myshopify.com"
SHEET_ID = "your-spreadsheet-id"
def gql(query, variables=None):
resp = http.post(f"https://{STORE}/admin/api/2025-07/graphql.json", json={"query": query, "variables": variables or {}},
headers={"X-Shopify-Access-Token": credentials.connection("shopify", "store")})
resp.raise_for_status()
return resp.json()["data"]
@on_event
def handle(event):
digest = base64.b64encode(hmac.new(credentials.secret("SHOPIFY_WEBHOOK_SECRET").encode(), event.body, hashlib.sha256).digest()).decode()
if not hmac.compare_digest(digest, event.header("X-Shopify-Hmac-Sha256") or ""):
return {"ignored": "bad signature"}
r = event.json
if state.get(f"refund:{r['id']}"):
return {"duplicate": True}
order = gql("query($id: ID!) { order(id: $id) { name } }", {"id": f"gid://shopify/Order/{r['order_id']}"})["order"]
items = ", ".join(f"{li['line_item']['title']} × {li['quantity']}" for li in r.get("refund_line_items", []))
paid = [t for t in r.get("transactions", []) if t.get("kind") == "refund" and t.get("status") == "success"]
amount = sum(float(t["amount"]) for t in paid)
currency = paid[0]["currency"] if paid else ""
restocked = "restocked" if any(li.get("restock_type") in ("return", "cancel") for li in r.get("refund_line_items", [])) else "not restocked"
row = [r["created_at"][:10], order["name"], items or "(amount only)", amount, currency, restocked, r.get("note") or ""]
build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False) \
.spreadsheets().values().append(spreadsheetId=SHEET_ID, range="Refunds!A:G", valueInputOption="USER_ENTERED",
body={"values": [row]}).execute()
state.set(f"refund:{r['id']}", True)
return {"logged": order["name"]}FAQ
Common questions
How do I connect the Shopify webhook?
What about refunds of shipping only?
Can it also note the refund reason?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Plan reorders from Shopify sales in a sheet
Each morning your Reorders sheet shows every product's stock, daily sales rate, days left and how many to reorder.
See how it worksLog late Shopify orders to a sheet
Every hour, paid orders that have missed your dispatch time are added to a sheet, and you get a Slack alert for each new one.
See how it worksCopy new Shopify customers to Google Sheets
New Shopify customers are added to a Customers tab with name, email, marketing consent, country, orders and amount spent.
See how it worksKeep exploring
Set up “Log Shopify refunds to Google Sheets” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.