Connectors

/

WooCommerce

/

Credit a WooCommerce refund in Dynamics 365 Business Central
Write
Cross-Connector

Turn a WooCommerce refund into a Business Central credit memo

For finance teams who want a WooCommerce refund credited against the right invoice in Dynamics 365 Business Central by their AI assistant.

Try PopdockAI free
Get a live demo
Credit a WooCommerce refund in Dynamics 365 Business Central
Credit WooCommerce refund 5521 in Business Central.
Refund 5521 on order 1042 for Contoso has not been credited yet. - Invoice: posted invoice PS-INV-1042 - Line: 2 x Travel mug at 18.00, 36.00 - Refund total: 36.00, matches the credit - Store note: the credit memo number goes on the web order Shall I create the unposted credit memo?
WooCommerce
Sample figures. Your results come from your own account.
woocommerce-get-refund
woocommerce-get-refund-line
woocommerce-add-order-note

On this page

The problem

The problem

The prompt

Who it's for

How it works

Tools used

Connector

WooCommerce

WooCommerce
Run it on your own WooCommerce data.

Connect WooCommerce, pick your AI tool and paste the prompt.

Try PopdockAI free

The problem

Refund credits that get missed or doubled

Each WooCommerce refund needs a credit memo in Dynamics 365 Business Central against the right invoice. Working out which lines and prices to credit, and making sure it was not already credited, is fiddly, and a duplicate overstates the customer's account.

Without PopdockAI

  • Read the refund and its lines in WooCommerce
  • Search Business Central for an existing credit memo
  • Find the posted invoice and its prices
  • Key in the memo and hope it was not done already

With PopdockAI

  • The refund is read and existing credit memos are checked first
  • Each refunded quantity is credited at the invoiced price
  • You approve the plan before anything is written
  • The memo is created unposted, its total checked and the order noted

The prompt

Use this prompt

Copy it into any AI tool connected to PopdockAI. Swap the values in braces for your own.

Prompt
**Objective:** Create an unposted Business Central sales credit memo for WooCommerce refund {refund-id}, applied to the posted invoice for its order, then note the credit memo number on the WooCommerce order. Use Business Central company {company} (if blank, leave `company` off).

**Step 1: Read the refund in WooCommerce**

Call `woocommerce-get-refund` with `refund-id` set to {refund-id}. If nothing comes back, report that and stop. Note order-id, order-number, amount (treat it as positive), reason and created-date. Call `woocommerce-get-refund-line` with the same `refund-id` for each line-item-sku, line-item-quantity and line-item-total. If there are no lines, it is an amount-only refund.

**Step 2: Check it has not already been credited**

Call `woocommerce-get-refund` with `order-number` set to the order-number to see all refunds on the order. Call `business-central-get-posted-sales-credit-memo` and `business-central-get-sales-transaction` (credit memo documents only), each with `external-document-number` set to the order-number. If the existing Business Central credit memos already cover this refund (as many credit memos as refunds, or a credit memo total matching this refund's amount), report them and stop.

**Step 3: Find the invoice being credited**

Call `business-central-get-posted-sales-invoice` with `external-document-number` set to the order-number. If nothing comes back, report that the order has not been invoiced in Business Central, so there is nothing to credit yet, and stop. If more than one comes back, list them and ask the user which to credit. Keep invoice-number, sell-to-customer-number and bill-to-customer-number.

**Step 4: Build the lines**

Call `business-central-get-posted-sales-invoice-line` with `invoice-number` set to the invoice. For each refund line, find the invoice line whose number equals the line-item-sku. Credit the refunded quantity at the invoice line's unit-price. If a refund line's SKU is not on the invoice, stop and list it.

For an amount-only refund, ask the user which G/L account to credit, and use one G/L account line for the refund amount.

**Step 5: Confirm**

Show the planned credit memo: customer, invoice it applies to, external document number, and a table of line type, number, description, quantity, unit price and amount, with the total next to the WooCommerce refund amount. Wait for the user to confirm.

**Step 6: Create**

Call `business-central-create-sales-credit-memo` once, with `customer-number`, `bill-to-customer-number`, `invoice-number` set to the invoice, and `external-document-number` set to the order-number. Then call `business-central-create-sales-credit-memo-line` once per line, with `document-number` set to the new credit memo's number, the line type, `number-on-line`, `quantity` and `unit-price`.

**Step 7: Record and confirm**

Call `woocommerce-add-order-note` with the refund's `order-id`, `customer-note` false (private), and a note giving the refund id and the new credit memo number. Then call `business-central-get-sales-transaction-line` with `document-number` set to the credit memo number and compare its total with the refund amount.

**Report:** the credit memo number, invoice credited, lines, Business Central total against the WooCommerce refund amount, and a reminder that the credit memo is unposted and needs review and posting in Business Central.

**Rules & Guidelines:**

* Tools whose names start with woocommerce- are on the woocommerce server; tools whose names start with business-central- are on the business-central server.
* The only writes allowed are `business-central-create-sales-credit-memo` (once), `business-central-create-sales-credit-memo-line` (once per line) and `woocommerce-add-order-note` (once, private), all after confirmation.
* Do not call `woocommerce-add-refund` (the refund already exists), `woocommerce-update-order`, or `business-central-update-sales-credit-memo`. Do not post the credit memo.

**Validation:**

* If a line create fails partway, stop and report the credit memo number and which lines were created. Do not create the credit memo header again.
* If the Business Central total differs from the refund amount by more than 0.01, report the difference (tax or shipping is the usual cause) rather than adjusting lines.

Who it's for

One answer, three teams that use it

Accounts receivable

Credit refunds at the invoiced price

Each refunded line is credited at the price it was invoiced, ready to review and post.

Create a Business Central credit memo for WooCommerce refund 6140.

Finance controllers

Stop duplicate credits

It stops when a memo already covers the refund, so customer balances are not understated.

Has WooCommerce refund 5893 already been credited in Business Central? If not, credit it.

Ecommerce accountants

Link refunds back to the store

A private note on the web order records the credit memo, so anyone can trace it later.

Credit WooCommerce refund 7002 in Business Central and note it on the order.

How it works

What PopdockAI does when you ask

You give the refund ID, and your AI assistant builds the credit memo from the posted invoice. Nothing is written until you confirm, and the memo is left unposted.

01

Ask

You give the refund ID.

Your AI tool

02

Check

It reads the refund and stops if Business Central already credits it.

woocommerce-get-refund
woocommerce-get-refund-line

03

Build

It finds the posted invoice and credits each refunded quantity at its price.

No items found.

04

Confirm

You approve the plan, then the unposted memo is created and the order noted.

Your AI tool

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.

get-data

woocommerce-get-refund

Returns WooCommerce refunds with amount, reason, who made them and whether the gateway returned the money. Filter by order, customer, amount range and date range.
get-data

woocommerce-get-refund-line

Returns the refunded product lines on WooCommerce refunds: product, SKU, quantity and amount. Filter by refund, order, customer, product id or SKU and date range.
run-action

woocommerce-add-order-note

Adds a note to a WooCommerce order by id, either private to store staff or emailed to the customer.
Read only.Nothing in WooCommerce Changes

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.

How Popdock AI secures your data

The outcome

Accurate draft credit memos, never twice

Try PopdockAI free
Get a live demo

Related use cases

More ways to put this data to work

All Ramp use cases

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.

Try PopdockAI Free
See Documentation