Skip to content

basalt / subscriptions/src / PaymentStore

Interface: PaymentStore ​

Defined in: subscriptions/src/payment.ts:132

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).

Methods ​

create() ​

> create(payment): Promise<void>

Defined in: subscriptions/src/payment.ts:134

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

Parameters ​

payment ​

NewPayment

Returns ​

Promise<void>


get() ​

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

Defined in: subscriptions/src/payment.ts:141

Parameters ​

id ​

string

Returns ​

Promise<PaymentRecord | undefined>


setStatus() ​

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

Defined in: subscriptions/src/payment.ts:136

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>

Released under the MIT License.