UNPKG

@sumup/sdk

Version:

The official TypeScript SDK for the SumUp API

104 lines 5.81 kB
import { APIResource, type RequestOptions, type WithResponse } from "../../core"; import type { Checkout, CheckoutAccepted, CheckoutCreateRequest, CheckoutSuccess, ErrorBody, ErrorExtended, ProcessCheckout } from "../../types"; export type GetPaymentMethodsQueryParams = { amount?: number; currency?: string; }; export type GetPaymentMethodsResponse = { available_payment_methods?: { /** * The ID of the payment method. */ id: string; }[]; }; export type ListCheckoutsQueryParams = { checkout_reference?: string; }; export type ListCheckoutsResponse = CheckoutSuccess[]; export type ProcessCheckoutError = ErrorExtended /** * List of error messages. */ | ErrorExtended[]; export type CreateApplePaySessionParams = { /** * the context to create this apple pay session. */ context: string; /** * The target url to create this apple pay session. */ target: string; }; export type CreateApplePaySessionResponse = Record<string, unknown>; export type CreateApplePaySessionError = ErrorBody /** * List of error messages. */ | ErrorBody[]; /** * API resource for the Checkouts endpoints. * * Checkouts represent online payment sessions that you create before attempting to charge a payer. A checkout captures the payment intent, such as the amount, currency, merchant, and optional customer or redirect settings, and then moves through its lifecycle as you process it. * * Use this tag to: * - create a checkout before collecting or confirming payment details * - process the checkout with a card, saved card, wallet, or supported alternative payment method * - retrieve or list checkouts to inspect their current state and associated payment attempts * - deactivate a checkout that should no longer be used * * Typical workflow: * - create a checkout with the order amount, currency, and merchant information * - process the checkout through SumUp client tools such as the [Payment Widget and Swift Checkout SDK](https://developer.sumup.com/online-payments/checkouts) * - retrieve the checkout or use the Transactions endpoints to inspect the resulting payment record * * Checkouts are used to initiate and orchestrate online payments. Transactions remain the authoritative record of the resulting payment outcome. */ export declare class Checkouts extends APIResource { /** * Get payment methods available for the given merchant to use with a checkout. */ listAvailablePaymentMethods(merchantCode: string, query?: GetPaymentMethodsQueryParams, options?: RequestOptions): Promise<GetPaymentMethodsResponse>; listAvailablePaymentMethodsWithResponse(merchantCode: string, query?: GetPaymentMethodsQueryParams, options?: RequestOptions): Promise<WithResponse<GetPaymentMethodsResponse>>; /** * Lists created checkout resources according to the applied `checkout_reference`. */ list(query?: ListCheckoutsQueryParams, options?: RequestOptions): Promise<CheckoutSuccess[]>; listWithResponse(query?: ListCheckoutsQueryParams, options?: RequestOptions): Promise<WithResponse<CheckoutSuccess[]>>; /** * Creates a new payment checkout resource. The unique `checkout_reference` created by this request, is used for further manipulation of the checkout. * * For 3DS checkouts, add the `redirect_url` parameter to your request body schema. * To use the [Hosted Checkout](https://developer.sumup.com/online-payments/checkouts/hosted-checkout/) page, set the `hosted_checkout.enabled` to `true`. * * Follow by processing a checkout to charge the provided payment instrument. */ create(body: CheckoutCreateRequest, options?: RequestOptions): Promise<Checkout>; createWithResponse(body: CheckoutCreateRequest, options?: RequestOptions): Promise<WithResponse<Checkout>>; /** * Retrieves an identified checkout resource. Use this request after processing a checkout to confirm its status and inform the end user respectively. */ get(id: string, options?: RequestOptions): Promise<CheckoutSuccess>; getWithResponse(id: string, options?: RequestOptions): Promise<WithResponse<CheckoutSuccess>>; /** * Processing a checkout will attempt to charge the provided payment instrument for the amount of the specified checkout resource initiated in the `Create a checkout` endpoint. * * Follow this request with `Retrieve a checkout` to confirm its status. */ process(id: string, body: ProcessCheckout, options?: RequestOptions): Promise<CheckoutSuccess | CheckoutAccepted>; processWithResponse(id: string, body: ProcessCheckout, options?: RequestOptions): Promise<WithResponse<CheckoutSuccess | CheckoutAccepted>>; /** * Deactivates an identified checkout resource. If the checkout has already been processed it can not be deactivated. */ deactivate(id: string, options?: RequestOptions): Promise<Checkout>; deactivateWithResponse(id: string, options?: RequestOptions): Promise<WithResponse<Checkout>>; /** * Creates an Apple Pay merchant session for the specified checkout. * * Use this endpoint after the customer selects Apple Pay and before calling * `ApplePaySession.completeMerchantValidation(...)` in the browser. * SumUp validates the merchant session request and returns the Apple Pay * session object that your frontend should pass to Apple's JavaScript API. * */ createApplePaySession(id: string, body?: CreateApplePaySessionParams, options?: RequestOptions): Promise<CreateApplePaySessionResponse>; createApplePaySessionWithResponse(id: string, body?: CreateApplePaySessionParams, options?: RequestOptions): Promise<WithResponse<CreateApplePaySessionResponse>>; } //# sourceMappingURL=index.d.cts.map