import { OrderRequestBody } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { PaymentInitializeOptions } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { PaymentIntegrationService } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { PaymentMethod } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { PaymentRequestOptions } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { PaymentStrategyFactory } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { RequestOptions } from '@bigcommerce/checkout-sdk/payment-integration-api'; import { RequestSender } from '@bigcommerce/request-sender'; import { Response } from '@bigcommerce/request-sender'; import { ScriptLoader } from '@bigcommerce/script-loader'; declare interface KlarnaAddress { street_address: string; street_address2?: string; city: string; country: string; given_name: string; family_name: string; phone?: string; postal_code: string; region: string; email?: string; } declare interface KlarnaAddress_2 { street_address: string; street_address2?: string; city: string; country: string; given_name: string; family_name: string; phone?: string; postal_code: string; region: string; email?: string; organization_name?: string; } declare interface KlarnaAuthorizationResponse { authorization_token: string; approved: boolean; show_form: boolean; error?: { invalid_fields: string[]; }; } declare interface KlarnaAuthorizationResponse_2 { authorization_token?: string; approved: boolean; show_form?: boolean; error?: { invalid_fields: string[]; }; } declare interface KlarnaAuthorizeOptions { instance_id?: string; payment_method_category: string; } declare interface KlarnaCredit { authorize(data: KlarnaUpdateSessionParams, callback: (res: KlarnaAuthorizationResponse) => void): void; init(params: KlarnaInitParams): void; load(params: KlarnaLoadParams, callback: (res: KlarnaLoadResponse) => void): void; } declare interface KlarnaInitParams { client_token: string; } declare interface KlarnaInitParams_2 { client_token: string; } declare interface KlarnaLoadParams { container: string; payment_method_category?: string; payment_method_categories?: string; instance_id?: string; preferred_payment_method?: string; } declare interface KlarnaLoadParams_2 { container: string; payment_method_category?: string; payment_method_categories?: string; instance_id?: string; preferred_payment_method?: string; } declare interface KlarnaLoadResponse { show_form: boolean; error?: { invalid_fields: string[]; }; } declare interface KlarnaLoadResponse_2 { show_form: boolean; error?: { invalid_fields: string[]; }; } /** * A set of options that are required to initialize the Klarna payment method. * * When Klarna is initialized, a widget will be inserted into the DOM. The * widget has a list of payment options for the customer to choose from. * * ```html * *
* ``` * * ```js * service.initializePayment({ * methodId: 'klarna', * klarna: { * container: 'container' * }, * }); * ``` * * An additional event callback can be registered. * * ```js * service.initializePayment({ * methodId: 'klarnav2', * klarnav2: { * container: 'container', * onLoad(response) { * console.log(response); * }, * }, * }); * ``` */ declare interface KlarnaPaymentInitializeOptions { /** * The ID of a container which the payment widget should insert into. */ container: string; /** * A callback that gets called when the widget is loaded and ready to be * interacted with. * * @param response - The result of the initialization. It indicates whether * or not the widget is loaded successfully. */ onLoad?(response: KlarnaLoadResponse): void; } declare class KlarnaPaymentStrategy { private paymentIntegrationService; private klarnaScriptLoader; private klarnaCredit?; private unsubscribe?; constructor(paymentIntegrationService: PaymentIntegrationService, klarnaScriptLoader: KlarnaScriptLoader); initialize(options: PaymentInitializeOptions & WithKlarnaPaymentInitializeOptions): Promise