Recurly automation
Refund a Recurly invoice line item
A customer was charged for a setup fee twice, and support has the invoice number in a ticket. Someone with refund rights opens the invoice and works through the refund form line by line.
Cotlet does it in your own Recurly account with get_invoice and refund_invoice, called by your AI agent, an n8n workflow or a script.
Hosted · nothing to install or maintain
Can Recurly do this on its own?
Recurly's API refunds an invoice by line item, with the adjustment uuid, quantity and a prorate flag (checked 14 Oct 2026). The Admin Console also refunds a specific amount or a percentage. Nothing in either reads the ticket, picks the right line item or writes the result back, and the API needs the site's private key.
How you do it in Recurly today
- In the Admin Console, open the invoice from the account or the invoice dashboard.
- Open the Invoice Actions dropdown and select Issue Refund.
- On the Issue Refund page, choose to refund by line item or for the entire invoice.
- Choose a refund method: Quantity, Specific amount or Percentage.
- Submit, then find the refund credit invoice that Recurly creates and note its number in the ticket.
How to refund a Recurly invoice line item
Refund 1 unit of the setup fee on invoice 1042 back to the account, then show me the refund invoice. - 01
Read the invoice first
The agent opens the invoice with get_invoice and checks that it is collected, that the line item named in the ticket exists and that it has not already been refunded. A line that was already refunded stops the job.
- 02
Choose the smallest refund
If the ticket says one unit, the agent refunds quantity 1. If it names an amount or a percentage, it uses that method instead, and tells you when your site does not support it.
- 03
Ask before money moves
refund_invoice shows the invoice, the line item and the amount, and waits for your OK. Nothing is refunded before you confirm, until you switch confirmation off for this tool.
- 04
Return the refund invoice
After the call the agent reads back the refund credit invoice, its total and its state, so you can paste them into the ticket.
What you get back
Invoice 1042: setup fee, $9.00 x 2, collected
Refund requested: quantity 1, to account credit
Confirmed by you at 10:12
Refund invoice created: total -$9.00, state collected
Remaining on invoice 1042: $9.00 Other ways to ask
- Refund 50% of the plan charge on invoice 1077 and tell me the new total.
- Refund $15.00 from the total of invoice 1090 to the original payment method.
- Check invoice 1042 and tell me what has already been refunded, but do not refund anything.
- Refund the last invoice of account acme-co for the whole amount, after you show it to me.
What Recurly allows, and what to know first
- Recurly refunds by line item or for the entire invoice, with methods Quantity, Specific amount and Percentage.
- Merchants without the Only Bill What Changed and Credit Memos features can only refund by quantity on line items or by specific amount on the entire invoice.
- A refund generates a refund credit invoice with credit line items against the previously paid charge line items.
- In the API, refund_apply_order credit or transaction sets which refund method is used first, and the default is credit back to the account.
- An invoice with a processed line item refund cannot accept refunds of an open amount.
refund_invoice asks for your OK by default. To run it on a schedule without you, switch confirmation off for that tool in your dashboard.
Sources: Recurly Docs: Invoice management · Recurly API reference: Line Item Refunds · Recurly Docs: Refund
Call refund_invoice from a script
curl -X POST https://cotlet.dev/api/v1/recurly/invoices/1042/refund \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"method":"quantity","line_item_id":"3dc1a8f09b4c4e55a1e0","quantity":1,"refund_apply_order":"credit"}' {
"refund_invoice_number": "1105",
"original_invoice_number": "1042",
"state": "collected",
"subtotal_in_cents": -900,
"total_in_cents": -900,
"currency": "USD",
"refund_apply_order": "credit"
} MCP: add https://cotlet.dev/mcp/v1 with the same key; the call is recurly_write → refund_invoice. Example data.
Schedule it in n8n, Make, Zapier or cronRecurly tools this automation uses
| Tool | Parameters |
|---|---|
| get_invoice | invoice_number |
| refund_invoice | invoice_number, method, line_item_id, quantity, amount_in_cents, percentage, prorate, refund_apply_order |
Frequently asked questions
Can the agent refund more than the customer paid?
No. The refund amount comes from the line items you select and the invoice they sit on, and Recurly rejects a refund that does not fit the invoice.
Is it safe to connect Recurly to Cotlet?
Yes. You sign in to Recurly yourself, in your own Cloud Browser in the EU, and we never save your password. Your agents only get Recurly once you enable it, every background request is listed, and the browser profile is stored encrypted with AES-256-GCM, the cipher 1Password uses for its vaults. The AI model never sees a login, posts and messages wait for your OK, and Disable for agents cuts access in one click. Independent scanners grade cotlet.dev A+ on Qualys SSL Labs, securityheaders.com and Mozilla Observatory; live results are on https://cotlet.dev/security.
Give your agent access to Recurly.
Free 7-day trial with 2,000 credits, no card needed. Cotlet is independent and not affiliated with Recurly.