Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "spec/methods/payment/payment"

Index

Modules

Cancel

Cancel:

Cancel a given user's subscription to DappBot. This will immediately delete all the customer's dapps, zero out their dapp limits, cancel the subscription on Stripe, and leave the user in the CANCELLED state.

Result

Result:

cancelledSub

cancelledSub: Subscription

Args

Args: void

No body arguments required, user's email is inferred from Authorization token.

Response

Response: ApiResponse<Result>

Const HTTP

HTTP: DELETE = "DELETE"

Const Path

Path: string = paymentBasePath

Read

Read:

Retrieve a given user's Stripe details, specifically their customer, subscription, and an invoice. If they're lapsed, then it's the most recent failed invoice. If they're active, it's the upcoming invoice. For all Stripe details, if this user does not have Stripe, they will be null.

Result

Result:

customer

customer: Customer | null

invoice

invoice: Invoice | null

subscription

subscription: Subscription | null

user

user: UserData | null

Args

Args: void

Body has no args, customer email is read via the Authorization token.

Response

Response: ApiResponse<Result>

Const HTTP

HTTP: GET = "GET"

Const Path

Path: string = paymentBasePath

SignUp

SignUp:

Main method to create a new account. If called as an API customer, you can only create a trial account. Card info can only ever be plugged in through the DappBot web interface.

Args

Args:

The token here is produced by Stripe on dapp.bot and cannot be created by external API customers. If it is not provided, then the new account is automatically created with a two-week free trial that allows one standard dapp.

Optional coupon

coupon: undefined | string

email

email: string

Optional metadata

metadata: undefined | object

name

name: string

plans

Optional token

token: undefined | string

Result

Result:

stripeId

stripeId: string

subscriptionId

subscriptionId: string

user

user: UserData | null

Response

Response: ApiResponse<Result>

Const HTTP

HTTP: POST = "POST"

Const Path

Path: string = paymentBasePath

isArgs

  • isArgs(val: any): boolean

newArgs

  • Factory to produce an Args object with empty strings for auth and a trial stripe plan. Useful for getting the correct shape as a value.

    Returns Args

StripeTypes

StripeTypes:

The subset of Stripe's types which we use, extracted into a convenient namespace. For more info about how the underlying objects look, check the official Stripe documentation -- it's excellent.

Card

Card: AllStripeTypes.ICard

Customer

Customer: AllStripeTypes.customers.ICustomer

Invoice

Invoice: AllStripeTypes.invoices.IInvoice

LineItem

LineItem: AllStripeTypes.invoices.IInvoiceLineItem

Subscription

Subscription: AllStripeTypes.subscriptions.ISubscription

SubscriptionState

SubscriptionState: AllStripeTypes.subscriptions.SubscriptionStatus

Const ValidSubscriptionStates

ValidSubscriptionStates: SubscriptionState[] = ['trialing','active']

Array of subscription states which translate to an active payment status for the underlying user.

UpdateCard

UpdateCard:

Used to update the customer's saved payment source, currently a credit card.

Args

Args:

Like with SignUp, this token can only be produced on the dapp.bot website using Stripe's client-side plugin. This method cannot be successfully called by external API customers.

token

token: string

Result

Result:

Optional retriedInvoice

retriedInvoice: Invoice

updatedCustomer

updatedCustomer: Customer

Response

Response: ApiResponse<Result>

Const HTTP

HTTP: PUT = "PUT"

Const Path

Path: string = paymentBasePath

isArgs

  • isArgs(val: any): boolean

newArgs

  • Factory to produce an Args object with an empty string. Useful for getting the correct shape as a value, without having to hardcode strings.

    Returns Args

UpdatePlanCount

UpdatePlanCount:

Update the number of allowed dapps for each type. This method can only be called by active accounts with a working payment source. Your account's next invoice will be prorated to reflect the updated capacity.

Args

Args:

plans

Result

Result:

updatedSubscription

updatedSubscription: Subscription

updatedUser

updatedUser: UserData | null

Response

Response: ApiResponse<Result>

Const HTTP

HTTP: PUT = "PUT"

Const Path

Path: string = paymentBasePath

isArgs

  • isArgs(val: any): boolean

newArgs

  • Factory to produce an Args object with one standard dapp. Useful for getting the correct shape as a value, without having to hardcode strings.

    Returns Args

Interfaces

StripePlans

StripePlans:

Listing of how many dapps a customer has allowed for each tier. Note that all must be specified, including 0 values, for safety.

enterprise

enterprise: number

professional

professional: number

standard

standard: number

Variables

Const paymentBasePath

paymentBasePath: string = `${apiBasePath}/${RootResources.payment}/stripe`

Const trialStripePlan

trialStripePlan: freeTierStripePlan = freeTierStripePlan

Functions

freeTierStripePlan

isStripePlans

  • isStripePlans(val: any): boolean

Generated using TypeDoc