UNPKG

@square/web-payments-sdk-types

Version:

Types for Square's Web Payments SDK

44 lines (43 loc) 1.78 kB
import type { PublicErrors } from './errors'; import type { Payments } from './payments'; /** * The entry point of the Web Payments SDK. * @example * <script type="text/javascript" src="https://sandbox.web.squarecdn.com/v1/square.js"></script> * <script> * const payments = window.Square.payments(applicationId, locationId); * </script> */ interface Square { /** * An array of programmatically handleable error types for ease of matching * using instanceof */ errors: PublicErrors; /** * The entry point to Square Payments. Use this method to configure your * applicationId and locationId * * The `payments` object provides the factory functions used to * create payment methods. * * @example * const APPLICATION_ID = 'Your application ID here'; * const LOCATION_ID = 'Your location ID here'; * const payments = Square.payments(APPLICATION_ID, LOCATION_ID); * * @param applicationId The Application ID of your square developer application. This * can be found in your Square Developer Dashboard. * @param locationId The Location ID of the seller location where the payment is taken. This * can be found in your Square Developer Dashboard. This is required to accept Apple Pay, * Google Pay, ACH, and Cash App payments. * * @throws {InvalidApplicationIdError} The applicationID is invalid * @throws {ApplicationIdEnvironmentMismatchError} The applicationID does not * match the environment (sandbox/prod) * @throws {BrowserNotSupportedError} The browser is not supported * @throws {WebSdkEmbedError} The Web SDK instance cannot be embedded */ payments(applicationId: string, locationId?: string): Payments; } export { Square };