/
/
Credit every WooCommerce refund on the right Rillet invoice
For finance teams who want WooCommerce refunds booked as Rillet credit memos and applied to the original invoice by their AI assistant.
On this page
Connector
Connect WooCommerce, pick your AI tool and paste the prompt.
The problem
Refunds that leave receivables overstated
A WooCommerce refund still needs a Rillet credit memo applied to the original invoice, or receivables stay overstated. Finding the invoice, checking whether the refund was booked and applying the right amount is easy to get wrong.
Without PopdockAI
- List refunds from WooCommerce
- Find each original invoice in Rillet
- Check whether a memo already exists
- Apply the amount by hand and hope it is right
With PopdockAI
- Each refund's Rillet invoice is found
- Refunds that already have a memo are skipped
- Manual refunds and orders with no invoice are flagged
- Memos are applied after you confirm, capped at the amount due
The prompt
Use this prompt
Copy it into any AI tool connected to PopdockAI. Swap the values in braces for your own.
**Objective:** For each WooCommerce refund made from `{from-date}` to `{to-date}` (default: the last 7 days), create a Rillet credit memo against the Rillet product `{rillet-product-name}` and apply it to the order's Rillet invoice, after the user confirms.
**Step 1: Read the WooCommerce refunds**
Call `woocommerce-get-refund` with created-date.from and created-date.to set to the range. Note refund-id, order-id, order-number, created-date, amount, reason, refunded-payment and customer-email. Use the amount as a positive number whatever its sign.
For detail, call `woocommerce-get-refund-line` filtered by refund-id and note line-item-name, line-item-quantity, line-item-total and line-item-total-tax.
**Step 2: Find the Rillet invoice and any existing memo**
Call `rillet-get-invoices` (no filters) and find the invoice whose invoice-number equals the order-number, with or without a leading #, or equals the order-id. Then call `rillet-get-credit-memos` filtered by credit-memo-number R- followed by the refund-id. If one exists, the refund is already booked. Skip it.
**Step 3: Resolve the product**
Call `rillet-get-products` and find the product whose name equals `{rillet-product-name}`. If none or more than one matches, list the candidates and stop.
**Step 4: Confirm**
Show a table: order-number, refund-id, refund date, amount, currency (from the invoice), reason, invoice-number, invoice amount-due, and the lines refunded. Flag any refund whose refunded-payment shows the money was not returned through the payment gateway, so the user knows it was refunded by hand. List separately the refunds with no Rillet invoice, and those already booked. Ask the user to confirm. Create nothing until they do.
**Step 5: Create and apply**
For each confirmed refund:
1. Call `rillet-add-credit-memo` once with customer-id (from the invoice), credit-memo-date (the refund date), credit-memo-number R- followed by the refund-id, line1-product-id, line1-quantity 1, line1-unit-amount the refund amount, line1-currency the invoice currency, and line1-description WooCommerce refund followed by the order-number and the reason if there is one.
2. If the invoice amount-due is above 0, call `rillet-apply-credit-memo` once with id (the new memo id), line1-invoice-id, line1-amount (the refund amount, capped at the invoice amount-due), line1-currency and line1-date (the refund date). If amount-due is 0, leave the memo unapplied and say the invoice was already paid, so the cash refund needs recording separately.
**Step 6: Report**
Memos created, and whether each was applied and for how much, with their ids. Any step that failed with the error as returned. The skipped refunds. Note that each memo carries the gross refunded amount, tax included, on one line.
**Rules & Guidelines:**
* `woocommerce-get-refund` and `woocommerce-get-refund-line` are on the woocommerce server. `rillet-get-invoices`, `rillet-get-credit-memos`, `rillet-get-products`, `rillet-add-credit-memo` and `rillet-apply-credit-memo` are on the rillet server.
* The only write tools this prompt may call are `rillet-add-credit-memo` and `rillet-apply-credit-memo`, once each per confirmed refund. Apply only a memo this prompt just created: `rillet-apply-credit-memo` replaces a memo's existing applications.
* Do not call `rillet-update-credit-memo`, `rillet-unapply-credit-memo`, `rillet-update-invoice`, `woocommerce-add-refund` or any other woocommerce write tool. The refund already exists in WooCommerce.
**Validation:**
* If there are no refunds in the range, say so and stop.
* If a refund's order has no Rillet invoice, do not book it. Suggest running backfill-woocommerce-orders first.
* If the credit memo is created but applying it fails, report the memo id as created but unapplied. Do not create a second memo.
* If the user does not confirm, create nothing.Who it's for
One answer, three teams that use it
Accounts receivable
Book refunds without the hunt
Each refund is matched to its invoice with the reason and balance shown, ready to confirm.
Book WooCommerce refunds from October as Rillet credit memos against Online sales.
Finance controllers
Keep receivables true
Memos are applied up to the amount due, so customer balances reflect what they actually owe.
Which WooCommerce refunds this month have no Rillet credit memo yet?
Ecommerce accountants
Handle manual refunds carefully
Refunds paid back outside the gateway are flagged, so you can check them before booking.
Show last week's WooCommerce refunds with manual ones flagged before we credit them in Rillet.
How it works
What PopdockAI does when you ask
You give a date range and the product to credit, and your AI assistant prepares a memo for each refund. Nothing is created until you confirm, and no memo is ever created twice.
01
Ask
You give a date range and the Rillet product to credit.
02
Match
It finds each refund's Rillet invoice and skips refunds with a memo.
03
Confirm
You review refunds, reasons and balances, with manual refunds flagged.
04
Create
It creates each memo and applies it, capped at the amount due.
What PopdockAI provides
The tools behind the answer
Ready made tools for WooCommerce and one secure connection to your AI tool. No code, no exports.
woocommerce-get-refund
woocommerce-get-refund-line
rillet-get-invoices
rillet-get-credit-memos
rillet-get-products
rillet-add-credit-memo
rillet-apply-credit-memo
This report is built from Get data tools only. PopdockAI applies the row, field and parameter rules your admin sets, and every query is written to the audit trail.
The outcome
Every refund credited on the right invoice, once
Related use cases
More ways to put this data to work
One prompt template with infinite possibilities.
Your AI assistant adapts its approach, tone, and capabilities to match each unique context while you maintain a single, manageable workflow.
Join forward-thinking companies that are transforming their operations with intelligent, secure AI automation.

.webp)
