Refunds

Refund all or part of a payment, and let Borga issue the matching credit note in your accounting system.

A refund returns money to the payer's card. Refunds are their own object (ref_…) so a payment can have several partial refunds over time. Bank-invoice payments cannot be refunded through Borga; issue a credit note in your accounting system and pay the customer back directly.

Create a refund

Node.jsts
// Partial refund. Omit `amount` to refund everything that is left.
const refund = await borga.refunds.create(
  {
    payment: "pay_7Hs2Kq9LmW4xZc1Vb8Ny3Rt6",
    amount: 990,
    reason: "Returned one item",
    metadata: { ticket: "support_1729" },
  },
  { idempotencyKey: "refund_support_1729" },
);

console.log(refund.status); // "pending" until payment.refunded arrives

Omit amount to refund the full remaining balance. The refundable balance is the payment's amount minus refunded_amount minus any refunds still pending, so two concurrent partial refunds cannot exceed the payment. Only payments in status succeeded or processing can be refunded.

Always send an Idempotency-Key with refunds. A retried request with the same key returns the original refund instead of creating a second one; see Idempotency.

Statuses

StatusMeaning
pendingAccepted by the processor, awaiting confirmation. refund.created fired.
succeededConfirmed. The payment's refunded_amount has increased and payment.refunded fired. When fully refunded, the payment's status becomes refunded.
failedThe processor rejected the refund. Nothing was returned.

Confirmation usually arrives within seconds. The money reaches the payer's card in a few business days depending on their bank.

Credit notes

If the original payment was booked as an invoice in PayDay or DK+, a succeeded refund creates a credit note there for the refunded amount and Borga records it as a CreditNote object (cn_…) with credit_note.created. Your books therefore show the sale and the reversal without manual work. See Invoicing.

Errors

CodeMeaning
payment_not_refundableThe payment is not succeeded or processing.
amount_too_largeMore than the refundable balance.
card_payment_reverse_failedThe processor refused. The refund is recorded as failed.
card_payment_reverse_uncertainThe processor did not answer. The refund stays pending; check its status before retrying.

Fees

The fee on the original payment is not returned. There is no fee on the refund itself.