Skip to Content
better-auth-nuvion

Refunds

Reverse a split payment by sending each moved share back to the merchant, and what a refund does not do.

const { data } = await authClient.nuvion.payments.refund({ paymentId });
// { status: "refund-started", reversals: 2, paymentStatus: "refund_partial", legs: [...] }

A refund makes the merchant's account whole. For every split leg that was sent or completed, the plugin creates a reversal leg that moves the same amount from the beneficiary back to the organization that paid it. Legs that had not been sent yet (pending or failed) are cancelled.

BeforeAfter
Merchant paid the reseller 150, platform 150A reversal of 150 from the reseller and 150 from the platform, back to the merchant
Unsent or failed legsCancelled

Statuses

The payment moves to refund_partial while reversals are outstanding, and to refunded when every reversal has completed (confirmed by outflows.completed webhooks). Calling refund again returns already-refunded and does nothing.

Rules

  • You must be an owner or admin of the payment's organization.
  • A payment that is still pending (never paid) cannot be refunded: it returns 400.
  • Each beneficiary-to-origin pair needs a counterparty. The plugin creates it the first time a refund needs it, on the beneficiary's own entity.

The customer is not paid back

Nuvion documents no refund API for funding-session inflows, so the plugin only reverses the split. Returning the money to the customer is a separate step you handle (for example a payout from the merchant's account). The outflows.refunded webhook is acknowledged but not yet mapped back to a payment.

On this page