Skip to content

basalt / subscriptions-prisma/src / PrismaPaymentStore

Class: PrismaPaymentStore ​

Defined in: subscriptions-prisma/src/index.ts:403

A ledger of payments keyed by the gateway payment id. Apps record a payment as pending on createPayment and let the webhook flip it to paid/failed — no more hand-rolling this per app. A memory implementation ships here; back it with your database in production (a Payment table keyed by id).

Implements ​

Constructors ​

Constructor ​

> new PrismaPaymentStore(client, options?): PrismaPaymentStore

Defined in: subscriptions-prisma/src/index.ts:406

Parameters ​

client ​

PrismaPaymentsClient

options? ​

PrismaSubscriptionsStoreOptions = {}

Returns ​

PrismaPaymentStore

Methods ​

create() ​

> create(payment): Promise<void>

Defined in: subscriptions-prisma/src/index.ts:413

Insert a pending payment. Idempotent: a no-op if the id already exists.

Parameters ​

payment ​

NewPayment

Returns ​

Promise<void>

Implementation of ​

PaymentStore.create


get() ​

> get(id): Promise<PaymentRecord | undefined>

Defined in: subscriptions-prisma/src/index.ts:452

Parameters ​

id ​

string

Returns ​

Promise<PaymentRecord | undefined>

Implementation of ​

PaymentStore.get


setStatus() ​

> setStatus(id, status, patch?): Promise<void>

Defined in: subscriptions-prisma/src/index.ts:428

Apply a terminal status; upserts if the payment wasn't recorded first.

Parameters ​

id ​

string

status ​

PaymentRecordStatus

patch? ​
amount? ​

number

raw? ​

unknown

Returns ​

Promise<void>

Implementation of ​

PaymentStore.setStatus

Released under the MIT License.