UNPKG

bc-payments-sdk

Version:

BetterCommerce's Payments NodeJS SDK is a complete solution for storefront clients that integrate payments. `bc-payments-sdk` is a single point interface for storefront clients for interacting with payment gateways.

58 lines (57 loc) 3.1 kB
import { BasePaymentProvider } from "../../base/entity/BasePaymentProvider"; import { IPaymentProvider } from "../../base/contracts/IPaymentProvider"; import { IKlarnaPaymentProvider } from "../../base/contracts/GatewayProviders/IKlarnaPaymentProvider"; /** * Class {KlarnaPayment} is a concrete implementation of a payment provider. * It provides a set of methods that can be used to interact with the Klarna payment gateway. * * @class KlarnaPayment * @extends {BasePaymentProvider} * @implements {IPaymentProvider} * @implements {IKlarnaPaymentProvider} */ export declare class KlarnaPayment extends BasePaymentProvider implements IPaymentProvider, IKlarnaPaymentProvider { /** * Initializes a payment intent using the Klarna payment gateway. * * This method initializes the SDK and attempts to create a payment intent * with the provided data. If successful, it returns the result of the intent * creation. If the SDK initialization fails, it returns null. In case of an * error during the process, it returns an object containing the error details. * * API Reference - https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-1-initiate-a-payment/ * * @param data - The payment intent data required by Klarna. * @returns A promise that resolves to the result of the payment intent creation * or an object with error details if an error occurs. */ initPaymentIntent(data: any): Promise<any>; /** * Creates a one time payment order. This method initializes the SDK and attempts to create a payment intent * with the provided data. If successful, it returns the result of the intent creation. If the SDK initialization fails, it returns null. In case of an * error during the process, it returns an object containing the error details. * * API Reference - https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-3-create-an-order/create-a-one-time-payment-order/ * * @param data - The payment intent data required by Klarna. * @returns A promise that resolves to the result of the payment intent creation * or an object with error details if an error occurs. */ createOneTimePaymentOrder(data: any): Promise<any>; requestPayment(data: any): Promise<any>; /** * Retrieves the details of an order from Klarna. * * This method attempts to retrieve the order details with the provided data. * If successful, it returns the result of the order details request. * If the SDK initialization fails, it returns null. In case of an * error during the process, it returns an object containing the error details. * * API Reference - https://docs.klarna.com/api/ordermanagement/#operation/getOrder * * @param data - The order ID required by Klarna. * @returns A promise that resolves to the result of the order details request * or an object with error details if an error occurs. */ getOrderDetails(data: any): Promise<any>; }