Refunds a restore's catch-up did not apply
This page handles each refund hardcount restore catch-up listed instead of applying, at step 7 of Restore Hardcount. Back to the runbook index.
Symptom
Section titled “Symptom”The catch-up printed lines under Refunds not applied, because applying them could refund or reverse tax a second time:. Each names a refund (re_…), its amount in the currency’s smallest unit, its status, the payment and the invoice, and why it was not applied.
Each is a refund of a payment the restored database holds, made after the backup, which the restored database does not hold. The invoice shows that money as refundable again: until you have handled the refund, issue no credit note that refunds its invoice. Where this page has you record the refund in your own books only, the invoice keeps showing that amount as refundable. Lower any later refund or credit on that invoice by the amount, by hand.
made by Hardcount for credit note hc_: Hardcount made the refund for a credit note the restore lost, or left without the refund’s ID. Applied as a webhook, it would be acknowledged with no record.cn_ … made in Stripe; the invoice was reported to Stripe Tax: someone refunded in Stripe after the backup. The old server may have recorded it as a credit note and reversed its tax in Stripe Tax. Applied again, it would reverse the tax a second time.
made by Hardcount for credit note hc_. Look up the note, and the tax_ of the invoice the line names:
SET app.bypass_rls = 'on';SELECT id, status, stripe_refund_id FROM credit_notes WHERE id = 'hc_cn_…';SELECT tax_transaction_id FROM invoices WHERE id = 'hc_inv_…';Then, by what you see:
issued, without this refund’s ID: click Retry refund on it. Hardcount finds the refund by its metadata and records it, without refunding again.draft: click Void on it. Issuing it can refund the customer a second time. The refund is then recorded nowhere: go on as for No row, below, by the invoice’stax_.transaction_ id - No row, and the invoice’s
tax_is empty: record the refund with a credit note as in step 1 of A refund made in Stripe. Put the amount intransaction_ id out_, in place ofof_ band_ amount_ cents refund_andamount_ cents stripe_, and the refund’s ID in the reason.refund_ id - No row, and
tax_is set: the old server reversed the refund’s tax in Stripe Tax when it issued the note, and a new credit note would reverse it again. Record the refund in your own books only.transaction_ id
made in Stripe; the invoice was reported to Stripe Tax. Read the invoice’s tax_ with the second query above. Look in your Stripe Tax transactions for a reversal of the invoice’s tax_ made after the backup time, for this refund’s amount. If there is one, record the refund in your own books only. If not, record it with step 1 of A refund made in Stripe, which reverses its tax once.
Verify
Section titled “Verify”Each listed refund is recorded once: as a credit note on its invoice, or, where this page says so, in your own books.
Stuck, or found a bug? Ask in Discussions · Open an issue