Connectors

/

Shopify

/

Book Shopify refunds as Rillet credit memos
Write
Cross-Connector

Book every Shopify refund in Rillet, once

For finance teams who want Shopify refunds booked as Rillet credit memos and applied to the right invoice, by asking their AI assistant.

Try PopdockAI free
Get a live demo
Book Shopify refunds as Rillet credit memos
Book this week's Shopify refunds as credit memos in Rillet.
7 Shopify refunds this week, and 5 are ready to book. - Ready: 5 refunds, 642.50 USD - Already booked: #1038 has a credit memo - Pending: #1042, the money has not gone back yet Shall I create and apply the 5 credit memos?
Shopify
Sample figures. Your results come from your own account.
shopify-get-refund
shopify-get-transaction
shopify-get-refund-line
rillet-get-invoices
rillet-get-credit-memos
rillet-get-products
rillet-add-credit-memo
rillet-apply-credit-memo

On this page

The problem

The problem

The prompt

Who it's for

How it works

Tools used

Connector

Shopify

Shopify
Run it on your own Shopify data.

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

Try PopdockAI free

The problem

Every Shopify refund needs several lookups before it is booked

Each Shopify refund should become a Rillet credit memo applied to the order's invoice. Finding the refunded amount, the invoice and whether a memo already exists takes several lookups per refund, and booking one twice understates receivables.

Without PopdockAI

  • Open each Shopify refund and its transactions
  • Search Rillet for the order's invoice
  • Check whether a credit memo already exists
  • Book a refund twice or before the money went back

With PopdockAI

  • Shopify refunds are read with their successful transactions and lines
  • Each is matched to the order's Rillet invoice
  • Refunds that already have a memo are skipped and pending ones listed
  • One memo per refund is created and applied after you confirm

The prompt

Use this prompt

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

Prompt
**Objective:** For each Shopify refund created 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 Shopify refunds**

Call `shopify-get-refund` with created-at.from and created-at.to set to the range. Note refund-id, order-id, order-name, created-at and note.

For the refunded amount, call `shopify-get-transaction` filtered by order-id and keep transactions whose kind is a refund and whose status is success. Match each to its refund by processed-at. For detail, call `shopify-get-refund-line` filtered by order-refund-id and note name, quantity, subtotal and 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 name, compared with and without the leading #. Then call `rillet-get-credit-memos` filtered by invoice-id. If a memo already has credit-memo-number equal to R- followed by the refund-id, 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 name, refund-id, refund date, refunded amount, currency, invoice-number, invoice amount-due, and the lines refunded. 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 refunded amount, line1-currency, and line1-description Shopify refund followed by the order name.
2. Call `rillet-apply-credit-memo` once with id (the new memo id), line1-invoice-id, line1-amount (the refunded amount, capped at the invoice total), line1-currency and line1-date.

**Step 6: Report**

Memos created and applied with their ids, any step that failed with the error as returned, and the skipped refunds. Note that each memo carries the gross refunded amount, tax included, on one line.

**Rules & Guidelines:**

* `shopify-get-refund`, `shopify-get-transaction` and `shopify-get-refund-line` are on the shopify 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` or any shopify write tool.

**Validation:**

* If there are no refunds in the range, say so and stop.
* If a refund has no successful refund transaction, the money has not gone back yet. List it as pending and do not book it.
* 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 the week's refunds in one go

Turn a stack of refund lookups into one reviewed list, with memos created and applied for you.

Create Rillet credit memos for Shopify refunds from 1 to 7 November using the Online Sales product.

Controllers

Keep receivables accurate after returns

Refunds with an existing memo are skipped, so a rerun never understates what customers owe.

Which Shopify refunds this month are not booked in Rillet yet? Book them once I have looked.

Ecommerce accountants

Only book money that has gone back

Refunds whose money has not been returned yet are listed as pending, so the books match what actually left the bank.

Book last week's Shopify refunds in Rillet and tell me which ones are still pending.

How it works

What PopdockAI does when you ask

You choose a date range and a product, and your AI assistant matches each Shopify refund to its Rillet invoice. Nothing is booked until you have seen the refunds and said yes.

01

Ask

You choose a date range, the last 7 days by default, and a Rillet product.

Your AI tool

02

Match

It reads Shopify refunds and finds each order's Rillet invoice and any existing memo.

shopify-get-refund
shopify-get-transaction
shopify-get-refund-line
rillet-get-invoices
rillet-get-credit-memos

03

Confirm

You see the refunds to book and those still pending, and say yes.

No items found.

04

Book

It creates one memo per refund and applies it to the invoice.

Your AI tool

What PopdockAI provides

The tools behind the answer

Ready made tools for Shopify and one secure connection to your AI tool. No code, no exports.

get-data

shopify-get-refund

Returns Shopify refunds with their order and total adjustments. Filter by order, customer, customer email, refund and created date.
get-data

shopify-get-transaction

Returns the payment transactions on Shopify orders, such as authorizations, sales, captures and refunds, with gateway and status. Filter by order, customer, kind, status, gateway, amount and processed date.
get-data

shopify-get-refund-line

Returns the line items on Shopify refunds, with the subtotal and how each was restocked. Filter by refund, order, SKU, name and restock type.
get-data

rillet-get-invoices

Returns customer invoices (number, customer, dates, status, totals, amount due) from Rillet.
get-data

rillet-get-credit-memos

Returns customer credit memos (number, customer, invoice, totals) from Rillet.
get-data

rillet-get-products

Returns products (name, status, pricing, revenue account) from Rillet.
run-action

rillet-add-credit-memo

Creates a customer credit memo in Rillet with up to three lines. Apply it to invoices afterwards with Apply Rillet credit memo to invoices.
run-action

rillet-apply-credit-memo

Applies a credit memo to up to five invoices. This REPLACES the memo's existing applications: include every invoice it should stay applied to.
Read only.Nothing in Shopify 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

Each refund booked once, against the right invoice

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