Better Payment 0.11.1 API
    Preparing search index...

    Interface EndpointContext

    What plugins get in init, methods and endpoints

    interface EndpointContext {
        body: Record<string, unknown> | undefined;
        defaultProvider: string | undefined;
        errorCodes: Readonly<Record<string, string>>;
        logger: BetterPaymentLogger | undefined;
        mode: "sandbox" | "production";
        providerIds: readonly string[];
        query: URLSearchParams;
        request: BetterPaymentRequest;
        json(body: unknown, status?: number): BetterPaymentResponse;
        use(providerId: string): PaymentProvider;
    }

    Hierarchy (View Summary)

    Index
    body: Record<string, unknown> | undefined

    Parsed body (JSON or form-urlencoded), undefined when there is none

    defaultProvider: string | undefined

    The default provider, if any

    errorCodes: Readonly<Record<string, string>>

    Error codes declared by the plugins ($ERROR_CODES), with their default messages

    logger: BetterPaymentLogger | undefined
    mode: "sandbox" | "production"
    providerIds: readonly string[]

    Ids of the configured providers

    query: URLSearchParams
    • Builds a JSON response with a status code other than 200

      Parameters

      • body: unknown
      • Optionalstatus: number

      Returns BetterPaymentResponse

    • A provider by id. Its operations run with hooks and events.

      Parameters

      • providerId: string

      Returns PaymentProvider