@bates-solutions/squareup API Reference - v3.2.0
    Preparing search index...

    Module core

    @bates-solutions/squareup — a TypeScript wrapper for the Square API.

    The package's main entrypoint. Exports createSquareClient / SquareClient (one service per Square domain — payments, orders, customers, catalog, inventory, subscriptions, invoices, loyalty, gift cards, and more), the normalized error hierarchy (SquareError + parseSquareError), and money / idempotency utilities. Webhook helpers live in the @bates-solutions/squareup/server entrypoint.

    import { createSquareClient } from '@bates-solutions/squareup';

    const square = createSquareClient({
    accessToken: process.env.SQUARE_ACCESS_TOKEN!,
    environment: 'sandbox',
    });
    const payment = await square.payments.create({
    sourceId: 'cnon:card-nonce',
    amount: 1000,
    currency: 'USD',
    idempotencyKey: 'order-1042', // one key per order, so a retry can't charge twice
    });
    CardsService
    CatalogService
    CheckoutService
    CustomerGroupsService
    CustomersService
    GiftCardActivitiesService
    GiftCardsService
    InventoryService
    InvoicesService
    LocationsService
    LoyaltyService
    OAuthService
    OrderBuilder
    OrdersService
    PaymentsError
    PaymentsService
    RefundsService
    SquareApiError
    SquareAuthError
    SquareClient
    SquareError
    SquareNetworkError
    SquareOAuthClient
    SquarePaymentError
    SquareValidationError
    SubscriptionsService
    WebhookSubscriptionsService
    ActivateActivityDetails
    AdjustDecrementActivityDetails
    AdjustIncrementActivityDetails
    BuildAuthorizeUrlOptions
    Card
    CreateCardOptions
    CreateCustomerOptions
    CreateGiftCardActivityOptions
    CreateGiftCardOptions
    CreateOrderOptions
    CreatePaymentOptions
    CreateSubscriptionOptions
    CreateWebhookSubscriptionOptions
    Customer
    DeclineReason
    FindVariationsByCodeOptions
    FindVariationsByCodeResult
    GiftCard
    GiftCardActivity
    LineItemInput
    ListCardsOptions
    ListCustomersOptions
    ListGiftCardActivitiesOptions
    ListGiftCardsOptions
    ListRefundsOptions
    ListWebhookSubscriptionsOptions
    LoadActivityDetails
    Location
    Money
    MoneyInput
    OAuthTokens
    OAuthTokenStatus
    Order
    OrderDiscountInput
    OrderPricingOptions
    OrderTax
    OrderTaxInput
    OrderTender
    PaginatedResponse
    PaginationOptions
    PaymentRefund
    RedeemActivityDetails
    RefundPaymentOptions
    SearchCustomersOptions
    SearchOrdersOptions
    SearchRecentOrdersOptions
    SquareClientConfig
    SquareOAuthClientConfig
    Subscription
    SubscriptionPhaseInput
    SubscriptionPlan
    UpdateCustomerOptions
    UpdateOrderFulfillmentInput
    UpdateOrderOptions
    UpdateSubscriptionOptions
    UpdateWebhookSubscriptionOptions
    AdjustDecrementReason
    AdjustIncrementReason
    CreatedWebhookSubscription
    CurrencyCode
    CustomerSortField
    CustomerSortOrder
    GiftCardActivityType
    GiftCardDeactivateReason
    GiftCardGanSource
    GiftCardState
    GiftCardType
    OAuthScope
    OrderDiscountScope
    OrderDiscountType
    OrderTaxScope
    OrderTaxType
    PaymentSource
    SquareEnvironment
    SquareErrorCode
    SubscriptionCadence
    SubscriptionStatus
    SubscriptionTestResult
    WebhookSubscription
    CURRENCY_CODES
    buildAuthorizeUrl
    createIdempotencyKey
    createSquareClient
    createSquareOAuthClient
    declineReason
    formatMoney
    fromCents
    isCurrencyCode
    isRetryableSquareError
    toCents