export interface TotalsCalculationEntity { } export interface CalculateTotalsRequest extends CalculateTotalsRequestCouponOneOf, CalculateTotalsRequestGiftCardOneOf { /** Coupon ID. */ couponId?: string | null; /** Coupon code. */ couponCode?: string | null; /** Gift card ID. */ giftCardId?: string | null; /** Gift card code. */ giftCardCode?: string | null; /** * Calculation ID. An identifier of the entity that you are calculating totals for, for example, cart ID or checkout ID. * This value will be used in order to optimise calculations by caching. * If not passed, calculation might be slower in some cases. */ calculationId?: string | null; /** Line items for calculation. */ lineItems?: LineItem[]; /** Shipping address for tax and shipping calculation (if applicable). */ shippingAddress?: Address; /** Billing address. Used for calculating tax if all the items in the cart are not shippable. */ billingAddress?: Address; /** Details about selected shipping option. */ selectedShippingOption?: SelectedShippingOption; /** * Merchant discounts to apply to specific line items. If no `lineItemIds` are passed, the discount will be applied to the whole cart/checkout. * @deprecated */ merchantDiscounts?: MerchantDiscountInput[]; /** Buyer email. Used to enforce coupon [single-use per customer](https://support.wix.com/en/article/wix-stores-limiting-coupon-usage). If not passed, single coupon usage per customer will not be enforced. */ buyerEmail?: string | null; /** * Member id to use for this calculation * When not provided, given that the caller is a member, its member id will be used * Providing this require elevated permissions - ECOM.ADMIN_CALCULATE_TOTALS */ memberId?: string | null; /** * The selected memberships and which line items they apply to * When not provided, default selection will be returned * You can also set it to empty selection */ selectedMemberships?: SelectedMemberships; /** Buyer phone number. Used to get shipping rates. */ buyerPhone?: string | null; /** Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order. */ purchaseFlowId?: string | null; } /** @oneof */ export interface CalculateTotalsRequestCouponOneOf { /** Coupon ID. */ couponId?: string | null; /** Coupon code. */ couponCode?: string | null; } /** @oneof */ export interface CalculateTotalsRequestGiftCardOneOf { /** Gift card ID. */ giftCardId?: string | null; /** Gift card code. */ giftCardCode?: string | null; } export interface LineItem { /** Line item ID. */ _id?: string; /** Quantity. */ quantity?: number | null; /** * Optional references to the line item's origin catalog. * See [Catalog SPI](https://bo.wix.com/wix-docs/rest/ecommerce/catalog-spi/introduction) for more details. * This field may be empty in the case of a custom line item. * currently we only use the catalog app id to set tax=0 for specific apps. */ catalogReference?: CatalogReference; /** Product/booking/event name. */ productName?: string | null; /** Price. */ price?: string; /** Physical properties (if applicable). */ physicalProperties?: PhysicalProperties; /** Subscription settings. */ subscriptionSettings?: SubscriptionSettings; /** * Type of selected payment option for current item. Defaults to `FULL_PAYMENT_ONLINE`. * + `FULL_PAYMENT_ONLINE` - The entire payment for this item happens as part of the checkout. * + `FULL_PAYMENT_OFFLINE` - The entire payment for this item happens after the checkout. For example, when using cash, check, or other offline payment methods. * + `MEMBERSHIP` - Payment for this item is done by charging a membership. When this option is used, `lineItem.price.amount` is 0. * + `DEPOSIT_ONLINE` - Partial payment for the given item to be paid upfront during the checkout. Amount to be paid is defined by deposit_amount field. */ paymentOption?: PaymentOptionType; /** Service properties. When relevant, this contains information such as date and number of participants. */ serviceProperties?: ServiceProperties; /** * In cases where `catalogReference.catalogItemId` is NOT the actual catalog item ID, this field will return the true item's ID. * + For example, for Wix Bookings, `catalogReference.catalogItemId` is the booking ID. Therefore this value is set to the service ID. * + In most cases, this field has the same value as `catalogReference.catalogItemId`. * + Used in membership validation. */ rootCatalogItemId?: string | null; /** * Optional - partial amount of item's price to be paid now for checkout cases with DEPOSIT_ONLINE payment option * If omitted - item's price will not be split and is expected to be paid in single installment */ depositAmount?: string | null; /** full price of the item before all the discounts */ fullPrice?: string | null; /** The Item's Delivery Profile Id */ deliveryProfileId?: string | null; /** Item type. Either a preset type or custom. */ itemType?: ItemType; } /** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */ export interface CatalogReference { /** ID of the item within the catalog it belongs to. */ catalogItemId?: string; /** * ID of the app providing the catalog. * * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/). * * For items from Wix catalogs, the following values always apply: * + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` * + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` * + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"` */ appId?: string; /** * Additional item details in key:value pairs. Use this optional field to provide more specificity with item selection. The `options` field values differ depending on which catalog is providing the items. * * For products and variants from a Wix Stores catalog, learn more about [eCommerce integration](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration). */ options?: Record | null; } export interface PhysicalProperties { /** Line item weight. Measurement unit matches the weight unit specified in `weightUnit` in the request. */ weight?: number | null; /** Stock-keeping unit. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku). */ sku?: string | null; /** Whether this line item is shippable. */ shippable?: boolean; } export interface Scope { /** Scope namespace (Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans) */ namespace?: string; /** Coupon scope's applied group (e.g., event or ticket in Wix Events) */ group?: Group; } export interface Group { /** Coupon scope's group (e.g., product or collection in Wix Stores). See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). */ name?: string; /** Item ID (when the coupon scope is limited to just one item). */ entityId?: string | null; } export interface SubscriptionSettings { /** Frequency of recurring payment. Every day/week/month/year. */ frequency?: SubscriptionFrequency; } /** Frequency unit of recurring payment */ export declare enum SubscriptionFrequency { UNDEFINED = "UNDEFINED", DAY = "DAY", WEEK = "WEEK", MONTH = "MONTH", YEAR = "YEAR" } /** Type of selected payment option for catalog item */ export declare enum PaymentOptionType { /** The entire payment for this item happens as part of the checkout. */ FULL_PAYMENT_ONLINE = "FULL_PAYMENT_ONLINE", /** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */ FULL_PAYMENT_OFFLINE = "FULL_PAYMENT_OFFLINE", /** Payment for this item is done by charging a membership. When selected, `price` is `0`. */ MEMBERSHIP = "MEMBERSHIP", /** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */ DEPOSIT_ONLINE = "DEPOSIT_ONLINE", /** Payment for this item can only be done by charging a membership and must be manually redeemed in the dashboard by the site admin. When selected, `price` is `0`. */ MEMBERSHIP_OFFLINE = "MEMBERSHIP_OFFLINE" } export interface ServiceProperties { /** * Date and time the service is to be provided, in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. * For example, the start time of a class. */ scheduledDate?: Date | null; /** The number of people participating in the service. For example, the number of people attending a class or the number of people per hotel room. */ numberOfParticipants?: number | null; } export interface ItemType extends ItemTypeItemTypeDataOneOf { /** Preset item type. */ preset?: ItemTypeItemType; /** Custom item type. When none of the preset types are suitable, specifies the custom type. */ custom?: string; } /** @oneof */ export interface ItemTypeItemTypeDataOneOf { /** Preset item type. */ preset?: ItemTypeItemType; /** Custom item type. When none of the preset types are suitable, specifies the custom type. */ custom?: string; } export declare enum ItemTypeItemType { UNRECOGNISED = "UNRECOGNISED", PHYSICAL = "PHYSICAL", DIGITAL = "DIGITAL", GIFT_CARD = "GIFT_CARD", SERVICE = "SERVICE" } export interface TaxableAddress extends TaxableAddressTaxableAddressDataOneOf { /** taxable address type. if this field is selected, the address is automatically resolved, and the tax is calculated accordingly. */ addressType?: TaxableAddressType; } /** @oneof */ export interface TaxableAddressTaxableAddressDataOneOf { /** taxable address type. if this field is selected, the address is automatically resolved, and the tax is calculated accordingly. */ addressType?: TaxableAddressType; } export declare enum TaxableAddressType { UNKNOWN_TAXABLE_ADDRESS = "UNKNOWN_TAXABLE_ADDRESS", BUSINESS = "BUSINESS", BILLING = "BILLING", SHIPPING = "SHIPPING" } export interface ApiV1AdditionalFee { /** Additional fee's unique code or ID. */ code?: string | null; /** * Additional fee's name. * * Max: 50 characters */ name?: string; /** Total additional fees. This `price` does not include any taxes that may apply to these additional fees. */ price?: string; /** * Tax details. * * > **Note:** Tax is not calculated in the returned `price` even when `taxDetails.taxable` is `true`. */ taxDetails?: V1TaxDetails; } /** Tax details. */ export interface V1TaxDetails { /** Whether additional fee is taxable. */ taxable?: boolean; /** Reserved for internal use. */ taxGroupId?: string | null; } /** Physical address */ export interface Address { /** Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format. */ country?: string | null; /** Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format. */ subdivision?: string | null; /** City name. */ city?: string | null; /** Postal or zip code. */ postalCode?: string | null; /** Street address. */ streetAddress?: StreetAddress; /** Main address line (usually street name and number). */ addressLine1?: string | null; /** Free text providing more detailed address info. Usually contains apt, suite, floor. */ addressLine2?: string | null; /** * Country's full name. * @readonly */ countryFullname?: string | null; /** * Subdivision full-name. * @readonly */ subdivisionFullname?: string | null; } export interface StreetAddress { /** Street number. */ number?: string; /** Street name. */ name?: string; } export interface AddressLocation { /** Address latitude. */ latitude?: number | null; /** Address longitude. */ longitude?: number | null; } export interface SelectedShippingOption { /** Carrier ID. */ carrierId?: string | null; /** Selected shipping option code. For example, "usps_std_overnight". */ code?: string; } export interface MerchantDiscountInput { /** Discount amount. */ amount?: string; /** IDs of line items the discount applies to. */ lineItemIds?: string[]; } export interface SelectedMemberships { /** Selected memberships. */ memberships?: SelectedMembership[]; } export interface SelectedMembership { /** Membership ID. */ _id?: string; /** ID of the app providing this payment option. */ appId?: string; /** IDs of the line items this membership applies to. */ lineItemIds?: string[]; } export interface CarrierShippingOption { /** This carrier's unique ID */ carrierId?: string | null; /** Shipping service options offered by this carrier for this request */ shippingOptions?: ShippingOption; } export interface ShippingOption { /** * Unique code of provided shipping option like "usps_std_overnight". * For legacy calculators this would be the UUID of the option. */ code?: string; /** * Title of the option, such as USPS Standard Overnight Delivery (in the requested locale). * For example, "Standard" or "First-Class Package International". */ title?: string; /** Delivery logistics. */ logistics?: DeliveryLogistics; /** Sipping price information. */ cost?: ShippingPrice; /** Delivery solution allocations to different delivery carriers and delivery regions */ deliveryAllocations?: DeliveryAllocation[]; /** If the delivery solution is a partial and doesn't apply to all items. */ partial?: boolean | null; } export interface DeliveryLogistics { /** Expected delivery time, in free text. For example, "3-5 business days". */ deliveryTime?: string | null; /** Instructions for caller, e.g for pickup: "Please deliver during opening hours, and please don't park in disabled parking spot". */ instructions?: string | null; /** Pickup details. */ pickupDetails?: PickupDetails; } export interface PickupDetails { /** Pickup address. */ address?: Address; /** * Whether the pickup address is that of a business - this may effect tax calculation. * @deprecated */ businessLocation?: boolean; /** Pickup method */ pickupMethod?: PickupMethod; } export declare enum PickupMethod { UNKNOWN_METHOD = "UNKNOWN_METHOD", STORE_PICKUP = "STORE_PICKUP", PICKUP_POINT = "PICKUP_POINT" } export interface DeliveryTimeSlot { /** starting time of the delivery time slot */ from?: Date | null; /** ending time of the delivery time slot */ to?: Date | null; } export interface ShippingPrice { /** Shipping price. */ price?: MultiCurrencyPrice; /** Other costs such as insurance, handling & packaging for fragile items, etc. */ otherCharges?: OtherCharge[]; } export interface MultiCurrencyPrice { /** Amount. */ amount?: string; /** * Converted amount. * @readonly */ convertedAmount?: string; /** * Amount formatted with currency symbol. * @readonly */ formattedAmount?: string; /** * Converted amount formatted with currency symbol. * @readonly */ formattedConvertedAmount?: string; } export interface OtherCharge { /** Type of additional cost. */ type?: ChargeType; /** Price of added cost. */ price?: MultiCurrencyPrice; } export declare enum ChargeType { HANDLING_FEE = "HANDLING_FEE", INSURANCE = "INSURANCE" } export interface DeliveryAllocation { /** The delivery option's carrier details, could be multiple if the delivery option is a combination of multiple carriers */ deliveryCarrier?: Carrier; /** The delivery region that are relevant for this delivery solution. */ deliveryRegion?: Region; /** Populated if the delivery solution is a partially supplied by this carrier. */ applicableLineItems?: ApplicableLineItems; } export interface Carrier { /** The carrier app id */ appId?: string | null; /** Unique code that acts as an ID for a shipping rate. For example, `"usps_std_overnight"`. */ code?: string; } export interface Region { /** The delivery region id. */ _id?: string | null; /** The delivery region name. */ name?: string | null; } export interface ApplicableLineItems { /** Line items that the delivery solution is for. */ lineItemIds?: string[]; } export interface AppliedDiscount extends AppliedDiscountDiscountSourceOneOf { /** Coupon details. */ coupon?: Coupon; /** Merchant discount. */ merchantDiscount?: MerchantDiscount; /** Discount rule */ discountRule?: DiscountRule; /** Discount type. */ discountType?: DiscountType; /** * IDs of line items the discount applies to. * @deprecated IDs of line items the discount applies to. * @replacedBy line_items_discounts * @targetRemovalDate 2024-06-01 */ lineItemIds?: string[]; } /** @oneof */ export interface AppliedDiscountDiscountSourceOneOf { /** Coupon details. */ coupon?: Coupon; /** Merchant discount. */ merchantDiscount?: MerchantDiscount; /** Discount rule */ discountRule?: DiscountRule; } export declare enum DiscountType { GLOBAL = "GLOBAL", SPECIFIC_ITEMS = "SPECIFIC_ITEMS", SHIPPING = "SHIPPING" } /** Coupon */ export interface Coupon { /** Coupon ID. */ _id?: string; /** Coupon code. */ code?: string; /** Coupon value. */ amount?: MultiCurrencyPrice; /** Coupon name. */ name?: string; } export interface MerchantDiscount { /** Discount value. */ amount?: MultiCurrencyPrice; /** Discount Percentage. Will be calculated from items price before other discounts. */ percentage?: number | null; } export interface DiscountRule { /** Discount rule ID */ _id?: string; /** Discount rule name */ name?: DiscountRuleName; /** Discount value. */ amount?: MultiCurrencyPrice; } export interface DiscountRuleName { /** Original discount rule name (in site's default language). */ original?: string; /** Translated discount rule name according to buyer language. Defaults to `original` when not provided. */ translated?: string | null; } export interface LineItemDiscount { /** ID of line item the discount applies to. */ _id?: string; /** Discount value. */ totalDiscountAmount?: MultiCurrencyPrice; } export interface AdditionalFee { /** Additional fee's unique code (or ID) for future processing */ code?: string | null; /** Translated additional fee's name */ name?: string; /** Additional fee's price */ price?: string; /** Currency */ currency?: string; /** Tax details */ taxDetails?: TaxDetails; /** Provider's app id */ providerAppId?: string | null; /** * Optional - Line items associated with this additional fee. * If no `lineItemIds` are provided, the fee will be associated with the whole cart/checkout/order. */ lineItemIds?: string[]; } /** Tax Details. */ export interface TaxDetails { /** Indication if additional fee is taxable or not */ taxable?: boolean; /** Optional tax group ID to use when calculating tax for this additional fee */ taxGroupId?: string | null; } export declare enum DataFetchType { SHIPPING = "SHIPPING", DISCOUNT = "DISCOUNT", ADDITIONAL_FEES = "ADDITIONAL_FEES", ORDER_VALIDATION = "ORDER_VALIDATION" } export interface ExternalReference { /** * ID of the app associated with the purchase flow. * For example, the Wix Pay Links app ID. */ appId?: string; /** * Reference to an external resource ID. Used to link the purchase flow to a specific entity in an external system. * For example, a Wix Pay Link ID. */ resourceId?: string | null; } export interface CalculateTotalsResponse { /** Calculate line items. */ calculatedLineItems?: CalculatedLineItem[]; /** Price summary. */ priceSummary?: PriceSummary; /** Details of applied gift card. */ giftCard?: GiftCard; /** Tax summary. */ taxSummary?: TaxSummary; /** Shipping information. */ shippingInfo?: ShippingInformation; /** Applied discounts. */ appliedDiscounts?: AppliedDiscount[]; /** Calculation errors. */ calculationErrors?: CalculationErrors; /** Weight unit. */ weightUnit?: WeightUnit; /** Currency. */ currency?: string; /** * This is the display currency. Converted prices are presented in this currency. * @readonly */ conversionCurrency?: string; /** Whether tax is included in price. */ taxIncludedInPrice?: boolean; /** * Minimal amount to pay in order to place the order. * @readonly */ payNow?: PriceSummary; /** * Remaining amount for the order to be fully paid. * @readonly */ payLater?: PriceSummary; /** Information about valid and invalid memberships, and which ones are selected for usage. */ membershipOptions?: MembershipOptions; /** Additional Fees */ additionalFees?: V1AdditionalFee[]; /** * The site currency. * @readonly */ siteCurrency?: string; /** * The rate used when converting from the site currency to the checkout currency. * @readonly */ checkoutConversionRate?: string | null; /** * The pay now total amount after the gift card is applied. * @readonly */ payNowTotalAfterGiftCard?: MultiCurrencyPrice; /** * The total amount after gift card is applied. * @readonly */ totalAfterGiftCard?: MultiCurrencyPrice; } export interface CalculatedLineItem { /** Line item ID. */ lineItemId?: string; /** Price breakdown for this line item. */ pricesBreakdown?: LineItemPricesData; /** * Type of selected payment option for current item. Supported values: * + `"FULL_PAYMENT_ONLINE"` - The entire payment for this item will happen as part of the checkout * + `"FULL_PAYMENT_OFFLINE"` - The entire payment for this item will happen after the checkout * + `"MEMBERSHIP"` - This item cannot be paid via monetary payment options, only via non monetary option such membership. When this option is used, price must be set to 0 * + `"DEPOSIT_ONLINE"` - Partial payment of the given item will happen as part of the checkout. Amount to be paid is defined by deposit_amount field. */ paymentOption?: PaymentOptionType; } export interface LineItemPricesData { /** Total price after discounts and after tax. */ totalPriceAfterTax?: MultiCurrencyPrice; /** Total price after discounts, and before tax. */ totalPriceBeforeTax?: MultiCurrencyPrice; /** Tax details. */ taxDetails?: ItemTaxFullDetails; /** Total discount for all line items. */ totalDiscount?: MultiCurrencyPrice; /** Catalog price after catalog discount and automatic discounts. */ price?: MultiCurrencyPrice; /** Item price **before** line item discounts and **after** catalog-defined discount. Defaults to `price` when not provided. */ priceBeforeDiscounts?: MultiCurrencyPrice; /** Total price **after** catalog-defined discount and line item discounts. */ lineItemPrice?: MultiCurrencyPrice; /** Item price **before** line item discounts and **before** catalog-defined discount. Defaults to `price` when not provided. */ fullPrice?: MultiCurrencyPrice; } export interface ItemTaxFullDetails { /** Amount for which tax is calculated. */ taxableAmount?: MultiCurrencyPrice; /** Tax rate %, as a decimal point between 0 and 1. */ taxRate?: string; /** Calculated tax, based on `taxable_amount` and `tax_rate`. */ totalTax?: MultiCurrencyPrice; /** * If breakdown exists, the sum of rates in the breakdown must equal `tax_rate`. Deprecated - use 'tax_breakdown' instead. * @readonly * @deprecated */ rateBreakdown?: TaxRateBreakdown[]; } export interface TaxRateBreakdown { /** Name of tax against which the calculation was performed. */ name?: string; /** Rate at which this tax detail was calculated. */ rate?: string; /** Amount of tax for this tax detail. */ tax?: MultiCurrencyPrice; } /** * TaxBreakdown represents tax information for a line item. * It holds the tax amount and the tax rate for each tax authority that apply on the line item. */ export interface TaxBreakdown { /** The name of the jurisdiction to which this tax detail applies. For example, "New York" or "Quebec". */ jurisdiction?: string | null; /** The amount of this line item price that was considered nontaxable. (Decimal value) */ nonTaxableAmount?: MultiCurrencyPrice; /** The rate at which this tax detail was calculated, e.g 0.1000 signifies 10% tax and 2.0000 signifies 200% tax. (Decimal value) */ rate?: string | null; /** The amount of tax estimated for this line item. (Decimal value) */ taxAmount?: MultiCurrencyPrice; /** The taxable amount of this line item. */ taxableAmount?: MultiCurrencyPrice; /** The type of tax that was calculated. Depends on the jurisdiction's tax laws. For example, "Sales Tax", "Income Tax", "Value Added Tax", etc. */ taxType?: string | null; /** * The name of the tax against which this tax amount was calculated. For example, "NY State Sales Tax", "Quebec GST", etc. * This name should be explicit enough to allow the merchant to understand what tax was calculated. */ taxName?: string | null; /** The type of the jurisdiction in which this tax detail applies. */ jurisdictionType?: JurisdictionType; } /** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */ export declare enum JurisdictionType { UNDEFINED = "UNDEFINED", COUNTRY = "COUNTRY", STATE = "STATE", COUNTY = "COUNTY", CITY = "CITY", SPECIAL = "SPECIAL" } export interface PriceSummary { /** Subtotal of all line items, before discounts and before tax. */ subtotal?: MultiCurrencyPrice; /** Total shipping price, before discounts and before tax. */ shipping?: MultiCurrencyPrice; /** Total tax. */ tax?: MultiCurrencyPrice; /** Total calculated discount value. */ discount?: MultiCurrencyPrice; /** Total price after discounts, gift cards, and tax. */ total?: MultiCurrencyPrice; /** Total additional fees price before tax. */ additionalFees?: MultiCurrencyPrice; } export interface GiftCard { /** * Gift Card ID. * @deprecated */ _id?: string; /** Gift card obfuscated code. */ obfuscatedCode?: string; /** Gift card value. */ amount?: MultiCurrencyPrice; /** App ID of the gift card provider. */ appId?: string; /** * External ID in the gift card provider's system. * Used for integration and tracking across different platforms. */ externalId?: string | null; } export interface TaxSummary { /** * Amount for which tax is calculated, added from line items. * @readonly */ taxableAmount?: MultiCurrencyPrice; /** * Calculated tax, added from line items. * @readonly */ totalTax?: MultiCurrencyPrice; /** * Tax calculator that was active when the order was created. * @deprecated */ calculationDetails?: TaxCalculationDetails; } export interface TaxCalculationDetails extends TaxCalculationDetailsCalculationDetailsOneOf { /** Reason the manual calculation was used. */ manualRateReason?: ManualCalculationReason; /** Details of the fallback rate calculation. */ autoTaxFallbackDetails?: AutoTaxFallbackCalculationDetails; /** Rate calculation type. */ rateType?: RateType; } /** @oneof */ export interface TaxCalculationDetailsCalculationDetailsOneOf { /** Reason the manual calculation was used. */ manualRateReason?: ManualCalculationReason; /** Details of the fallback rate calculation. */ autoTaxFallbackDetails?: AutoTaxFallbackCalculationDetails; } export declare enum RateType { /** no tax being collected for this request due to location of purchase */ NO_TAX_COLLECTED = "NO_TAX_COLLECTED", /** manual rate used for calculation */ MANUAL_RATE = "MANUAL_RATE", /** autotax rate used for calculation */ AUTO_RATE = "AUTO_RATE", /** fallback rate used for calculation */ FALLBACK_RATE = "FALLBACK_RATE" } export declare enum ManualCalculationReason { /** user set calculator in Business Manager to be Manual */ GLOBAL_SETTING_TO_MANUAL = "GLOBAL_SETTING_TO_MANUAL", /** specific region is on manual even though Global setting is Auto-tax */ REGION_SETTING_TO_MANUAL = "REGION_SETTING_TO_MANUAL" } export interface AutoTaxFallbackCalculationDetails { /** reason for fallback */ fallbackReason?: FallbackReason; /** invalid request (i.e. address), timeout, internal error, license error, and others will be encoded here */ error?: ApplicationError; } export declare enum FallbackReason { /** auto-tax failed to be calculated */ AUTO_TAX_FAILED = "AUTO_TAX_FAILED", /** auto-tax was temporarily deactivated on a system-level */ AUTO_TAX_DEACTIVATED = "AUTO_TAX_DEACTIVATED" } export interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } /** * The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate. * Tax breakdown is the tax amount split to the tax authorities that applied on the line item. */ export interface AggregatedTaxBreakdown { /** The name of the tax against which this tax amount was calculated. */ taxName?: string; /** The type of tax that was calculated. Depends on the company's nexus settings as well as the jurisdiction's tax laws. */ taxType?: string; /** The name of the jurisdiction in which this tax detail applies. */ jurisdiction?: string; /** The type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */ jurisdictionTypeEnum?: JurisdictionType; /** The rate at which this tax detail was calculated, e.g 0.1000 signifies 10% tax and 2.000 signifies 200% tax. (Decimal value) */ rate?: string; /** The sum of all the tax from line items that calculated by the tax identifiers. */ aggregatedTaxAmount?: MultiCurrencyPrice; } export interface ShippingInformation { /** Shipping region. */ region?: ShippingRegion; /** Selected shipping option. */ selectedCarrierServiceOption?: SelectedCarrierServiceOption; /** All shipping options. */ carrierServiceOptions?: CarrierServiceOption[]; } export interface ShippingRegion { /** * Shipping region ID. * @readonly */ _id?: string; /** Shipping region name. */ name?: string; } export interface SelectedCarrierServiceOption { /** Unique identifier of selected option. For example, "usps_std_overnight". */ code?: string; /** * Title of the option, such as USPS Standard Overnight Delivery (in the requested locale). * For example, "Standard" or "First-Class Package International". * @readonly */ title?: string; /** * Delivery logistics. * @readonly */ logistics?: DeliveryLogistics; /** * Shipping costs. * @readonly */ cost?: SelectedCarrierServiceOptionPrices; /** * Were we able to find the requested shipping option, or otherwise we fallback to the default one (the first) * @readonly */ requestedShippingOption?: boolean; /** Other charges */ otherCharges?: SelectedCarrierServiceOptionOtherCharge[]; /** This carrier's unique ID */ carrierId?: string | null; /** Delivery solution allocations to different delivery carriers and delivery regions */ deliveryAllocations?: DeliveryAllocation[]; /** If the delivery solution is a partial and doesn't apply to all items. */ partial?: boolean | null; } export interface SelectedCarrierServiceOptionPrices { /** Total shipping price, after discount and after tax. */ totalPriceAfterTax?: MultiCurrencyPrice; /** Total price of shipping after discounts (when relevant), and before tax. */ totalPriceBeforeTax?: MultiCurrencyPrice; /** Tax details. */ taxDetails?: ItemTaxFullDetails; /** Shipping discount before tax. */ totalDiscount?: MultiCurrencyPrice; /** Shipping price before discount and before tax. */ price?: MultiCurrencyPrice; } export interface SelectedCarrierServiceOptionOtherCharge { /** Type of additional cost. */ type?: ChargeType; /** Details of the charge, such as 'Full Coverage Insurance of up to 80% of value of shipment'. */ details?: string | null; /** Price of added charge. */ cost?: SelectedCarrierServiceOptionPrices; } export interface CarrierServiceOption { /** Carrier ID. */ carrierId?: string; /** Shipping options offered by this carrier for this request. */ shippingOptions?: ShippingOption[]; } export interface CalculationErrors extends CalculationErrorsShippingCalculationErrorOneOf { /** General shipping calculation error. */ generalShippingCalculationError?: Details; /** Carrier errors. */ carrierErrors?: CarrierErrors; /** Tax calculation error. */ taxCalculationError?: Details; /** Coupon calculation error. */ couponCalculationError?: Details; /** Gift card calculation error. */ giftCardCalculationError?: Details; /** Order validation errors. */ orderValidationErrors?: ApplicationError[]; /** * Membership payment methods calculation errors * For example, will indicate that a line item that must be paid with membership payment doesn't have one or selected memberships are invalid */ membershipError?: Details; /** Discount Rule calculation error. */ discountsCalculationError?: Details; } /** @oneof */ export interface CalculationErrorsShippingCalculationErrorOneOf { /** General shipping calculation error. */ generalShippingCalculationError?: Details; /** Carrier errors. */ carrierErrors?: CarrierErrors; } export interface Details extends DetailsKindOneOf { applicationError?: ApplicationError; validationError?: ValidationError; systemError?: SystemError; /** * deprecated in API's - to enable migration from rendering arbitrary tracing to rest response * @deprecated */ tracing?: Record; } /** @oneof */ export interface DetailsKindOneOf { applicationError?: ApplicationError; validationError?: ValidationError; systemError?: SystemError; } /** * example result: * { * "fieldViolations": [ * { * "field": "fieldA", * "description": "invalid music note. supported notes: [do,re,mi,fa,sol,la,ti]", * "violatedRule": "OTHER", * "ruleName": "INVALID_NOTE", * "data": { * "value": "FI" * } * }, * { * "field": "fieldB", * "description": "field value out of range. supported range: [0-20]", * "violatedRule": "MAX", * "data": { * "threshold": 20 * } * }, * { * "field": "fieldC", * "description": "invalid phone number. provide a valid phone number of size: [7-12], supported characters: [0-9, +, -, (, )]", * "violatedRule": "FORMAT", * "data": { * "type": "PHONE" * } * } * ] * } */ export interface ValidationError { fieldViolations?: FieldViolation[]; } export declare enum RuleType { VALIDATION = "VALIDATION", OTHER = "OTHER", MAX = "MAX", MIN = "MIN", MAX_LENGTH = "MAX_LENGTH", MIN_LENGTH = "MIN_LENGTH", MAX_SIZE = "MAX_SIZE", MIN_SIZE = "MIN_SIZE", FORMAT = "FORMAT", DECIMAL_LTE = "DECIMAL_LTE", DECIMAL_GTE = "DECIMAL_GTE", DECIMAL_LT = "DECIMAL_LT", DECIMAL_GT = "DECIMAL_GT", DECIMAL_MAX_SCALE = "DECIMAL_MAX_SCALE", INVALID_ENUM_VALUE = "INVALID_ENUM_VALUE", REQUIRED_FIELD = "REQUIRED_FIELD", FIELD_NOT_ALLOWED = "FIELD_NOT_ALLOWED", ONE_OF_ALIGNMENT = "ONE_OF_ALIGNMENT", EXACT_LENGTH = "EXACT_LENGTH", EXACT_SIZE = "EXACT_SIZE", REQUIRED_ONE_OF_FIELD = "REQUIRED_ONE_OF_FIELD" } export interface FieldViolation { field?: string; description?: string; violatedRule?: RuleType; /** applicable when violated_rule=OTHER */ ruleName?: string | null; data?: Record | null; } export interface SystemError { /** Error code. */ errorCode?: string | null; } export interface CarrierErrors { /** Carrier errors. */ errors?: CarrierError[]; } export interface CarrierError { /** Carrier ID. */ carrierId?: string; /** Error details. */ error?: Details; } export declare enum WeightUnit { /** Weight unit can't be classified, due to an error */ UNSPECIFIED_WEIGHT_UNIT = "UNSPECIFIED_WEIGHT_UNIT", /** Kilograms */ KG = "KG", /** Pounds */ LB = "LB" } export interface MembershipOptions { /** List of payment options that can be used. */ eligibleMemberships?: Membership[]; /** List of payment options that are owned by the member, but cannot be used due to reason provided. */ invalidMemberships?: InvalidMembership[]; /** The selected membership payment options and which line items they apply to. */ selectedMemberships?: SelectedMembership[]; } export interface Membership { /** Membership ID. */ _id?: string; /** ID of the application providing this payment option. */ appId?: string; /** The name of this membership. */ name?: MembershipName; /** Line item IDs which are "paid" for by this membership. */ lineItemIds?: string[]; /** Optional - For a membership that has limited credits, information about credit usage. */ credits?: MembershipPaymentCredits; /** Optional - TMembership expiry date. */ expirationDate?: Date | null; /** Additional data about this membership. */ additionalData?: Record | null; } export interface MembershipName { /** Membership name. */ original?: string; /** Translated membership name. Defaults to `original` when not provided. */ translated?: string | null; } export interface MembershipPaymentCredits { /** Membership's total amount of credits. */ total?: number; /** Membership's remaining amount of credits. */ remaining?: number; } export interface InvalidMembership { /** Membership details. */ membership?: Membership; /** Reason why this membership is invalid and cannot be used. */ reason?: string; } export interface V1AdditionalFee { /** Additional fee's unique code (or ID) for future processing. */ code?: string | null; /** Translated additional fee's name. */ name?: string; /** Additional fee's price. */ price?: MultiCurrencyPrice; /** Tax details. */ taxDetails?: ItemTaxFullDetails; /** Provider's app id. */ providerAppId?: string | null; /** Additional fee's price before tax. */ priceBeforeTax?: MultiCurrencyPrice; /** Additional fee's price after tax. */ priceAfterTax?: MultiCurrencyPrice; /** * Optional - Line items associated with this additional fee. * If no `lineItemIds` are provided, the fee will be associated with the whole cart/checkout/order. */ lineItemIds?: string[]; /** the source the additional fee was added from */ source?: AdditionalFeeSource; } export declare enum AdditionalFeeSource { UNKNOWN_ADDITIONAL_FEE_SOURCE = "UNKNOWN_ADDITIONAL_FEE_SOURCE", /** The additional fee was added by an additional fee service plugin */ SERVICE_PLUGIN = "SERVICE_PLUGIN", /** The additional fee was added on the item either via the catalog or on custom line item */ ITEM = "ITEM", /** The additional fee was added manually on the request */ MANUAL = "MANUAL" } interface MultiCurrencyPriceNonNullableFields { amount: string; convertedAmount: string; formattedAmount: string; formattedConvertedAmount: string; } interface TaxRateBreakdownNonNullableFields { name: string; rate: string; tax?: MultiCurrencyPriceNonNullableFields; exemptAmount?: MultiCurrencyPriceNonNullableFields; exemptionIds: number[]; taxableAmount?: MultiCurrencyPriceNonNullableFields; } interface TaxBreakdownNonNullableFields { nonTaxableAmount?: MultiCurrencyPriceNonNullableFields; taxAmount?: MultiCurrencyPriceNonNullableFields; taxableAmount?: MultiCurrencyPriceNonNullableFields; jurisdictionType: JurisdictionType; } interface ItemTaxFullDetailsNonNullableFields { taxableAmount?: MultiCurrencyPriceNonNullableFields; taxRate: string; totalTax?: MultiCurrencyPriceNonNullableFields; rateBreakdown: TaxRateBreakdownNonNullableFields[]; exemptAmount?: MultiCurrencyPriceNonNullableFields; taxBreakdown: TaxBreakdownNonNullableFields[]; } interface LineItemPricesDataNonNullableFields { totalPriceAfterTax?: MultiCurrencyPriceNonNullableFields; totalPriceBeforeTax?: MultiCurrencyPriceNonNullableFields; taxDetails?: ItemTaxFullDetailsNonNullableFields; totalDiscount?: MultiCurrencyPriceNonNullableFields; price?: MultiCurrencyPriceNonNullableFields; priceBeforeDiscounts?: MultiCurrencyPriceNonNullableFields; lineItemPrice?: MultiCurrencyPriceNonNullableFields; fullPrice?: MultiCurrencyPriceNonNullableFields; } interface TaxableAddressNonNullableFields { addressType: TaxableAddressType; } interface CalculatedLineItemNonNullableFields { lineItemId: string; pricesBreakdown?: LineItemPricesDataNonNullableFields; paymentOption: PaymentOptionType; taxableAddress?: TaxableAddressNonNullableFields; } interface PriceSummaryNonNullableFields { subtotal?: MultiCurrencyPriceNonNullableFields; shipping?: MultiCurrencyPriceNonNullableFields; tax?: MultiCurrencyPriceNonNullableFields; discount?: MultiCurrencyPriceNonNullableFields; total?: MultiCurrencyPriceNonNullableFields; additionalFees?: MultiCurrencyPriceNonNullableFields; } interface GiftCardNonNullableFields { _id: string; obfuscatedCode: string; amount?: MultiCurrencyPriceNonNullableFields; appId: string; } interface ApplicationErrorNonNullableFields { code: string; description: string; } interface AutoTaxFallbackCalculationDetailsNonNullableFields { fallbackReason: FallbackReason; error?: ApplicationErrorNonNullableFields; } interface TaxCalculationDetailsNonNullableFields { manualRateReason: ManualCalculationReason; autoTaxFallbackDetails?: AutoTaxFallbackCalculationDetailsNonNullableFields; rateType: RateType; } interface AggregatedTaxBreakdownNonNullableFields { taxName: string; taxType: string; jurisdiction: string; jurisdictionTypeEnum: JurisdictionType; rate: string; aggregatedTaxAmount?: MultiCurrencyPriceNonNullableFields; aggregatedTaxableAmount?: MultiCurrencyPriceNonNullableFields; } interface TaxSummaryNonNullableFields { taxableAmount?: MultiCurrencyPriceNonNullableFields; totalTax?: MultiCurrencyPriceNonNullableFields; manualTaxRate: string; calculationDetails?: TaxCalculationDetailsNonNullableFields; totalExempt?: MultiCurrencyPriceNonNullableFields; aggregatedTaxBreakdown: AggregatedTaxBreakdownNonNullableFields[]; } interface ShippingRegionNonNullableFields { _id: string; name: string; } interface StreetAddressNonNullableFields { number: string; name: string; apt: string; } interface AddressNonNullableFields { streetAddress?: StreetAddressNonNullableFields; } interface PickupDetailsNonNullableFields { address?: AddressNonNullableFields; businessLocation: boolean; pickupMethod: PickupMethod; } interface DeliveryLogisticsNonNullableFields { pickupDetails?: PickupDetailsNonNullableFields; } interface SelectedCarrierServiceOptionPricesNonNullableFields { totalPriceAfterTax?: MultiCurrencyPriceNonNullableFields; totalPriceBeforeTax?: MultiCurrencyPriceNonNullableFields; taxDetails?: ItemTaxFullDetailsNonNullableFields; totalDiscount?: MultiCurrencyPriceNonNullableFields; price?: MultiCurrencyPriceNonNullableFields; } interface SelectedCarrierServiceOptionOtherChargeNonNullableFields { type: ChargeType; cost?: SelectedCarrierServiceOptionPricesNonNullableFields; } interface CarrierNonNullableFields { code: string; } interface ApplicableLineItemsNonNullableFields { lineItemIds: string[]; } interface DeliveryAllocationNonNullableFields { deliveryCarrier?: CarrierNonNullableFields; applicableLineItems?: ApplicableLineItemsNonNullableFields; } interface SelectedCarrierServiceOptionNonNullableFields { code: string; title: string; logistics?: DeliveryLogisticsNonNullableFields; cost?: SelectedCarrierServiceOptionPricesNonNullableFields; requestedShippingOption: boolean; otherCharges: SelectedCarrierServiceOptionOtherChargeNonNullableFields[]; deliveryAllocations: DeliveryAllocationNonNullableFields[]; } interface OtherChargeNonNullableFields { type: ChargeType; price?: MultiCurrencyPriceNonNullableFields; } interface ShippingPriceNonNullableFields { price?: MultiCurrencyPriceNonNullableFields; otherCharges: OtherChargeNonNullableFields[]; } interface ShippingOptionNonNullableFields { code: string; title: string; logistics?: DeliveryLogisticsNonNullableFields; cost?: ShippingPriceNonNullableFields; deliveryAllocations: DeliveryAllocationNonNullableFields[]; } interface CarrierServiceOptionNonNullableFields { carrierId: string; shippingOptions: ShippingOptionNonNullableFields[]; } interface ShippingInformationNonNullableFields { region?: ShippingRegionNonNullableFields; selectedCarrierServiceOption?: SelectedCarrierServiceOptionNonNullableFields; carrierServiceOptions: CarrierServiceOptionNonNullableFields[]; } interface CouponNonNullableFields { _id: string; code: string; amount?: MultiCurrencyPriceNonNullableFields; name: string; couponType: string; } interface MerchantDiscountNonNullableFields { amount?: MultiCurrencyPriceNonNullableFields; } interface DiscountRuleNameNonNullableFields { original: string; } interface DiscountRuleNonNullableFields { _id: string; name?: DiscountRuleNameNonNullableFields; amount?: MultiCurrencyPriceNonNullableFields; } interface LineItemDiscountNonNullableFields { _id: string; totalDiscountAmount?: MultiCurrencyPriceNonNullableFields; } interface AppliedDiscountNonNullableFields { coupon?: CouponNonNullableFields; merchantDiscount?: MerchantDiscountNonNullableFields; discountRule?: DiscountRuleNonNullableFields; discountType: DiscountType; lineItemIds: string[]; lineItemDiscounts: LineItemDiscountNonNullableFields[]; } interface FieldViolationNonNullableFields { field: string; description: string; violatedRule: RuleType; } interface ValidationErrorNonNullableFields { fieldViolations: FieldViolationNonNullableFields[]; } interface DetailsNonNullableFields { applicationError?: ApplicationErrorNonNullableFields; validationError?: ValidationErrorNonNullableFields; } interface CarrierErrorNonNullableFields { carrierId: string; error?: DetailsNonNullableFields; } interface CarrierErrorsNonNullableFields { errors: CarrierErrorNonNullableFields[]; } interface CalculationErrorsNonNullableFields { generalShippingCalculationError?: DetailsNonNullableFields; carrierErrors?: CarrierErrorsNonNullableFields; taxCalculationError?: DetailsNonNullableFields; couponCalculationError?: DetailsNonNullableFields; giftCardCalculationError?: DetailsNonNullableFields; orderValidationErrors: ApplicationErrorNonNullableFields[]; membershipError?: DetailsNonNullableFields; discountsCalculationError?: DetailsNonNullableFields; } interface MembershipNameNonNullableFields { original: string; } interface MembershipPaymentCreditsNonNullableFields { total: number; remaining: number; } interface MembershipNonNullableFields { _id: string; appId: string; name?: MembershipNameNonNullableFields; lineItemIds: string[]; credits?: MembershipPaymentCreditsNonNullableFields; } interface InvalidMembershipNonNullableFields { membership?: MembershipNonNullableFields; reason: string; } interface SelectedMembershipNonNullableFields { _id: string; appId: string; lineItemIds: string[]; } interface MembershipOptionsNonNullableFields { eligibleMemberships: MembershipNonNullableFields[]; invalidMemberships: InvalidMembershipNonNullableFields[]; selectedMemberships: SelectedMembershipNonNullableFields[]; } interface V1AdditionalFeeNonNullableFields { name: string; price?: MultiCurrencyPriceNonNullableFields; taxDetails?: ItemTaxFullDetailsNonNullableFields; priceBeforeTax?: MultiCurrencyPriceNonNullableFields; priceAfterTax?: MultiCurrencyPriceNonNullableFields; lineItemIds: string[]; source: AdditionalFeeSource; } export interface CalculateTotalsResponseNonNullableFields { calculatedLineItems: CalculatedLineItemNonNullableFields[]; priceSummary?: PriceSummaryNonNullableFields; giftCard?: GiftCardNonNullableFields; taxSummary?: TaxSummaryNonNullableFields; shippingInfo?: ShippingInformationNonNullableFields; appliedDiscounts: AppliedDiscountNonNullableFields[]; calculationErrors?: CalculationErrorsNonNullableFields; weightUnit: WeightUnit; currency: string; conversionCurrency: string; taxIncludedInPrice: boolean; payNow?: PriceSummaryNonNullableFields; payLater?: PriceSummaryNonNullableFields; membershipOptions?: MembershipOptionsNonNullableFields; additionalFees: V1AdditionalFeeNonNullableFields[]; siteCurrency: string; payNowTotalAfterGiftCard?: MultiCurrencyPriceNonNullableFields; totalAfterGiftCard?: MultiCurrencyPriceNonNullableFields; payAfterFreeTrial?: PriceSummaryNonNullableFields; } /** * Returns a totals calculation for specified line items. * @public * @documentationMaturity preview * @requiredField options.lineItems._id * @requiredField options.lineItems.price * @requiredField options.lineItems.quantity * @requiredField options.merchantDiscounts.amount * @requiredField options.selectedMemberships.memberships._id * @requiredField options.selectedMemberships.memberships.appId * @requiredField options.selectedMemberships.memberships.lineItemIds * @requiredField options.selectedShippingOption.code * @permissionId ECOM.CALCULATE_TOTALS * @permissionScope Manage Stores - all permissions * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES * @permissionScope Manage eCommerce - all permissions * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM * @applicableIdentity APP * @applicableIdentity VISITOR * @fqn com.wix.ecom.totals_calculator.v1.TotalsCalculator.CalculateTotals */ export declare function calculateTotals(options?: CalculateTotalsOptions): Promise; export interface CalculateTotalsOptions extends CalculateTotalsRequestCouponOneOf, CalculateTotalsRequestGiftCardOneOf { /** * Calculation ID. An identifier of the entity that you are calculating totals for, for example, cart ID or checkout ID. * This value will be used in order to optimise calculations by caching. * If not passed, calculation might be slower in some cases. */ calculationId?: string | null; /** Line items for calculation. */ lineItems?: LineItem[]; /** Shipping address for tax and shipping calculation (if applicable). */ shippingAddress?: Address; /** Billing address. Used for calculating tax if all the items in the cart are not shippable. */ billingAddress?: Address; /** Details about selected shipping option. */ selectedShippingOption?: SelectedShippingOption; /** Coupon ID. */ couponId?: string | null; /** Coupon code. */ couponCode?: string | null; /** Gift card ID. */ giftCardId?: string | null; /** Gift card code. */ giftCardCode?: string | null; /** * Merchant discounts to apply to specific line items. If no `lineItemIds` are passed, the discount will be applied to the whole cart/checkout. * @deprecated */ merchantDiscounts?: MerchantDiscountInput[]; /** Buyer email. Used to enforce coupon [single-use per customer](https://support.wix.com/en/article/wix-stores-limiting-coupon-usage). If not passed, single coupon usage per customer will not be enforced. */ buyerEmail?: string | null; /** * Member id to use for this calculation * When not provided, given that the caller is a member, its member id will be used * Providing this require elevated permissions - ECOM.ADMIN_CALCULATE_TOTALS */ memberId?: string | null; /** * The selected memberships and which line items they apply to * When not provided, default selection will be returned * You can also set it to empty selection */ selectedMemberships?: SelectedMemberships; /** Buyer phone number. Used to get shipping rates. */ buyerPhone?: string | null; /** Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order. */ purchaseFlowId?: string | null; } export {};