basalt / subscriptions/src / FakeBillingGateway
Class: FakeBillingGateway
Defined in: subscriptions/src/gateway.ts:212
Controllable in-process gateway — the test/dev driver.
Implements
Constructors
Constructor
> new FakeBillingGateway(): FakeBillingGateway
Returns
FakeBillingGateway
Properties
canceled
> readonly canceled: object[] = []
Defined in: subscriptions/src/gateway.ts:215
atPeriodEnd
> atPeriodEnd: boolean
gatewayRef
> gatewayRef: string
checkouts
> readonly checkouts: CheckoutInput[] = []
Defined in: subscriptions/src/gateway.ts:216
created
> readonly created: CreateSubscriptionInput[] = []
Defined in: subscriptions/src/gateway.ts:214
name
> readonly name: "fake" = 'fake'
Defined in: subscriptions/src/gateway.ts:213
Implementation of
portals
> readonly portals: PortalInput[] = []
Defined in: subscriptions/src/gateway.ts:217
resumed
> readonly resumed: string[] = []
Defined in: subscriptions/src/gateway.ts:219
swaps
> readonly swaps: object[] = []
Defined in: subscriptions/src/gateway.ts:218
gatewayRef
> gatewayRef: string
input
> input: SwapInput
Methods
cancelSubscription()
> cancelSubscription(gatewayRef, options): Promise<void>
Defined in: subscriptions/src/gateway.ts:227
Parameters
gatewayRef
string
options
atPeriodEnd
boolean
Returns
Promise<void>
Implementation of
BillingGateway.cancelSubscription
createCheckoutSession()
> createCheckoutSession(input): Promise<{ id: string; url: string; }>
Defined in: subscriptions/src/gateway.ts:231
Hosted Checkout session — returns a URL to redirect the customer to.
Parameters
input
Returns
Promise<{ id: string; url: string; }>
Implementation of
BillingGateway.createCheckoutSession
createPortalSession()
> createPortalSession(input): Promise<{ url: string; }>
Defined in: subscriptions/src/gateway.ts:237
Customer Portal session — returns a URL for self-service billing.
Parameters
input
Returns
Promise<{ url: string; }>
Implementation of
BillingGateway.createPortalSession
createSubscription()
> createSubscription(input): Promise<{ gatewayRef: string; }>
Defined in: subscriptions/src/gateway.ts:222
Parameters
input
Returns
Promise<{ gatewayRef: string; }>
Implementation of
BillingGateway.createSubscription
resumeSubscription()
> resumeSubscription(gatewayRef): Promise<void>
Defined in: subscriptions/src/gateway.ts:246
Withdraws a cancellation scheduled with cancelSubscription(ref, { atPeriodEnd: true }), so the gateway keeps renewing. Required by Subscriptions.resume() for a gateway-backed subscription.
Parameters
gatewayRef
string
Returns
Promise<void>
Implementation of
BillingGateway.resumeSubscription
swapSubscription()
> swapSubscription(gatewayRef, input): Promise<void>
Defined in: subscriptions/src/gateway.ts:242
Changes the plan on an existing subscription, applying proration.
Parameters
gatewayRef
string
input
Returns
Promise<void>
Implementation of
BillingGateway.swapSubscription
verifyWebhook()
> verifyWebhook(rawBody, signature): WebhookEvent
Defined in: subscriptions/src/gateway.ts:250
Verifies the signature and translates the payload. Throws WebhookInvalidError on a bad signature. Returns null for a verified event the gateway doesn't map to a domain event (gateways emit many event types we don't act on).
Parameters
rawBody
string
signature
string | undefined