Better Payment 0.11.1 API
    Preparing search index...

    Interface BetterPaymentOptions<P, Plugins>

    interface BetterPaymentOptions<
        P extends Record<string, ProviderEntry> = Record<string, ProviderEntry>,
        Plugins extends
            readonly BetterPaymentPlugin[] = readonly BetterPaymentPlugin[],
    > {
        defaultProvider?: keyof P & string;
        fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
        handler?: BetterPaymentHandlerOptions;
        logger?: BetterPaymentLogger;
        mode?: "sandbox" | "production";
        plugins?: Plugins;
        providers: P;
        retry?: RetryConfig;
        validate?: boolean;
    }

    Type Parameters

    Index
    defaultProvider?: keyof P & string

    Provider used by the operations on the payment object (payment.createPayment()). Default: the only provider, when there is exactly one.

    fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

    Custom fetch implementation for provider API calls (for example to add a proxy or for tests). Default: globalThis.fetch.

    Type Declaration

      • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
      • Parameters

        • input: RequestInfo | URL
        • Optionalinit: RequestInit

        Returns Promise<Response>

    Options for payment.handler

    mode?: "sandbox" | "production"

    'sandbox' selects test URLs and turns on provider test modes (PayTR test_mode, Akbank test gateways). Defaults to 'production'.

    plugins?: Plugins

    Plugins, applied in order

    providers: P

    Providers by id: { iyzico: iyzico({...}), paytr: paytr({...}) }. A custom provider can be passed as an instance of a PaymentProvider subclass.

    retry?: RetryConfig
    validate?: boolean

    Validate requests before calling providers. Default: true. Can be overridden per provider with validate in its config.