Schema
The table and column the plugin adds to organization, and its six nuvion tables.
Better Auth's CLI creates these (npx @better-auth/cli migrate, or generate for Prisma and Drizzle). Amounts and timestamps are bigint so they do not overflow on Postgres. id columns are added by Better Auth.
organization (extended)
| Column | Type | Notes |
|---|---|---|
parentOrganizationId | string, optional | the parent organization. Not settable through normal organization input; use set a parent |
nuvionBinding
Maps an organization to its Nuvion entity and account.
| Column | Type | Notes |
|---|---|---|
organizationId | string | unique |
entityId | string | Nuvion entity |
accountId | string | Nuvion account |
nuvionDestination
The saved counterparty for one (source, destination) pair of organizations.
| Column | Type | Notes |
|---|---|---|
fromOrganizationId | string | indexed; the organization that sends |
toOrganizationId | string | the organization that receives |
counterpartyId | string | Nuvion counterparty on the sending entity |
paymentDetailId | string | Nuvion book-transfer payment detail |
nuvionFeeRule
| Column | Type | Notes |
|---|---|---|
organizationId | string | unique; the child whose parent takes the fee |
flatMinor | bigint | |
bps | bigint | 0 to 10000 |
minMinor, capMinor | bigint, optional | |
bearer | string | payer or merchant |
nuvionPayment
| Column | Type | Notes |
|---|---|---|
organizationId | string | indexed; the leaf (merchant) |
reference | string | unique; pay_<uuid>, sent to Nuvion as unique_reference |
providerSessionId | string, optional | the Nuvion funding session id |
baseMinor | bigint | what the merchant asked to net |
chargedMinor | bigint | what the customer is charged |
currency | string | |
status | string | payment status |
createdAt | bigint | epoch ms |
nuvionLeg
One book transfer.
| Column | Type | Notes |
|---|---|---|
paymentId | string | |
kind | string | split or reversal |
fromOrganizationId, toOrganizationId | string | |
amountMinor | bigint | |
state | string | leg state |
attempt | bigint | the Nuvion reference is {id}-a{attempt} |
providerRef | string, optional | the Nuvion transfer id |
error | string, optional | last failure; cleared when a retry succeeds |
nuvionEvent
Claims each webhook event id once, for de-duplication.
| Column | Type | Notes |
|---|---|---|
eventId | string | unique |
receivedAt | bigint | epoch ms |