Rulesnorthwind-refund-without-reason

northwind-refund-without-reason

info

northwind/correctness/refund-without-reason

Docs page ↗

refunds.create is called with only the charge id, so every refund is recorded with the default reason regardless of why it was actually issued.

4

codebases affected, of 58

7%

of everything we scanned

no docs fix scored yet

0

docs commits aimed at this

Where it’s failing

refunds.create is called without a reason code.

what we find

what we change it to

await northwind.refunds.create({ charge: charge.id })
// silently recorded as "requested_by_customer",
// even when this is the fraud-review path
await northwind.refunds.create({
charge: charge.id,
reason: review.isFraud ? 'fraudulent' : 'requested_by_customer',
})

Pass reason explicitly — "duplicate", "fraudulent" or "requested_by_customer" — matching why the refund is being issued.

Metadata

Category
correctness
Type
suggestion
Severity
info
Recommended
yes
Languages
javascriptpython

Live telemetry

4 / 58 scans

Fired in 7% of scanned codebases.

After every docs commit

No docs commits target this rule yet. When one merges, the next weeks of scans re-score it here.

A fix for your docs page

Wherever this rule fires, a page on your docs site taught it. api-doctor writes the edit and opens it as a pull request on your docs repo — you review and merge.

No fix yet

Draft a docs fix for this rule

api-doctor writes the docs change from the fire pattern — you review it