> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # GetRule # Package: serviceFees # Namespace: ServiceFeesRules # Method link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/service-fees/rules/get-rule.md ## Permission Scopes: Manage Restaurants - all permissions: SCOPE.RESTAURANTS.MEGA-SCOPES ## Introduction Retrieves a rule. --- ## REST API ### Schema ``` Method: getRule Description: Retrieves a rule. URL: https://www.wixapis.com/service-fees/v1/rules/{ruleId} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: ruleId Method parameters: param name: ruleId | type: none | required: true Return type: GetRuleResponse - name: rule | type: Rule | description: The retrieved rule. - ONE-OF: - ONE-OF: - name: fixedFee | type: Money | description: Fixed fee. Must hold a positive value. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: percentageFee | type: string | description: Percentage fee. For example, `5` represents a 5% fee applied to the order's total. - ONE-OF: - ONE-OF: - name: conditionOptions | type: Condition | description: Single condition that must be met for the rule to be applied to an order. - ONE-OF: - name: number | type: Number | description: Contains a numeric value and an operation. Required if `expectedFieldType` is `NUMBER`. - name: value | type: number | description: Numeric value to compare with the value of the specified field. - name: operation | type: Operation | description: Operation to use. - enum: - EQ: Equal to. - LT: Strictly less than. - LE: Less than or equal to. - GT: Strictly greater than. - GE: Greater than or equal to. - name: list | type: List | description: Contains an array of strings to compare with the value of the specified field. If the value of the field matches a string in the array, the condition is considered met. Required if `expectedFieldType` is `LIST`. - name: values | type: array | description: Array of string values to compare with the value of the field. If the value of the fields matches a string in the array, the condition is considered met. - name: orderFieldPath | type: string | description: Path of the field in the order entity that this condition will evaluate. For example, `priceSummary.subtotal`. - name: expectedFieldType | type: ExpectedFieldType | description: Type of the field specified in `orderFieldPath`. For example, the type of `priceSummary.subtotal` is `"NUMBER"`). - enum: - UNKNOWN_EXPECTED_FIELD_TYPE: Unknown expected field type - NUMBER: Represents a number value. - STRING: Represents a string value. - name: conditionTreeOptions | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order. - ONE-OF: - name: leftCondition | type: Condition | description: Single condition that must be met for the rule to be applied to an order. - name: leftConditionsTree | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order. - ONE-OF: - name: rightCondition | type: Condition | description: Single condition that must be met for the rule to be applied to an order. - name: rightConditionsTree | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order. - name: operator | type: Operator | description: Specifies the logical operator to use when combining the evaluation of the left and right conditions. - enum: - AND: The condition is true if both the left and right sides are true. - OR: The condition is true if either the left or right side is true. - ONE-OF: - name: customTaxRate | type: string | description: Percentage value to apply as a custom tax rate. Range: [0-100]. - name: taxGroupId | type: string | description: Tax group GUID. Internal only. - name: id | type: string | description: Rule GUID. - name: locationId | type: string | description: Business location GUID ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/about-business-locations.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/restaurants/wix-restaurants-new/about-business-locations.md)) of the rule. - name: name | type: string | description: Rule name. - name: createdDate | type: string | description: Date and time the rule was created. - name: updatedDate | type: string | description: Date and time the rule was updated. - name: conditionType | type: ConditionType | description: Specifies the type of condition. - enum: - UNDEFINED_CONDITION_TYPE: Indicates that the Rule has no conditions specified. - CONDITION: Indicates that the Rule has a single Condition. - CONDITION_TREE: Indicates that the Rule has a complex condition specified as a ConditionTree. - name: enabled | type: boolean | description: Whether the rule is enabled. If `true`, the rule is evaluated when service fees are calculated. If `false`, the rule will not be evaluated when service fees are calculated. - name: revision | type: string | description: Revision number. Increments by 1 each time the rule is updated. To prevent conflicting changes, the existing `revision` must be used when updating a rule. - name: appId | type: string | description: Defines the app that the rule is connected to. - name: roundingStrategy | type: RoundingStrategy | description: Rounding strategy to apply to fee and tax calculation. - enum: - HALF_UP: Rounds up any number exactly halfway between two integers. For example, `2.5` rounds to `3`, and `3.5` and rounds to `4`. - HALF_EVEN: Rounds such numbers to the nearest even integer. For example, `2.5` rounds to `2`, but `3.5` rounds to `4`. - name: extendedFields | type: ExtendedFields | description: Data Extensions - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: Tags ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)) used to classify and sort different types of rules. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. ``` ### Examples ### Get a rule ```curl curl -X GET https://www.wixapis.com/service-fees-rules/v1/rules/4aea505e-ac49-4f72-b4f1-b07c064a20cd \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.serviceFees.ServiceFeesRules.getRule(ruleId) Description: Retrieves a rule. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: ruleId Method parameters: param name: ruleId | type: string | description: GUID of the rule to retrieve. | required: true Return type: PROMISE - ONE-OF: - ONE-OF: - name: fixedFee | type: Money | description: Fixed fee. Must hold a positive value. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: percentageFee | type: string | description: Percentage fee. For example, `5` represents a 5% fee applied to the order's total. - ONE-OF: - ONE-OF: - name: conditionOptions | type: Condition | description: Single condition that must be met for the rule to be applied to an order. - ONE-OF: - name: number | type: Number | description: Contains a numeric value and an operation. Required if `expectedFieldType` is `NUMBER`. - name: value | type: number | description: Numeric value to compare with the value of the specified field. - name: operation | type: Operation | description: Operation to use. - enum: - EQ: Equal to. - LT: Strictly less than. - LE: Less than or equal to. - GT: Strictly greater than. - GE: Greater than or equal to. - name: list | type: List | description: Contains an array of strings to compare with the value of the specified field. If the value of the field matches a string in the array, the condition is considered met. Required if `expectedFieldType` is `LIST`. - name: values | type: array | description: Array of string values to compare with the value of the field. If the value of the fields matches a string in the array, the condition is considered met. - name: orderFieldPath | type: string | description: Path of the field in the order entity that this condition will evaluate. For example, `priceSummary.subtotal`. - name: expectedFieldType | type: ExpectedFieldType | description: Type of the field specified in `orderFieldPath`. For example, the type of `priceSummary.subtotal` is `"NUMBER"`). - enum: - UNKNOWN_EXPECTED_FIELD_TYPE: Unknown expected field type - NUMBER: Represents a number value. - STRING: Represents a string value. - name: conditionTreeOptions | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order. - ONE-OF: - name: leftCondition | type: Condition | description: Single condition that must be met for the rule to be applied to an order. - name: leftConditionsTree | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order. - ONE-OF: - name: rightCondition | type: Condition | description: Single condition that must be met for the rule to be applied to an order. - name: rightConditionsTree | type: ConditionTree | description: Binary tree of conditions. Use the operator to indicate whether only one or both conditions must be met in order for a service fee rule to be applied to an order. - name: operator | type: Operator | description: Specifies the logical operator to use when combining the evaluation of the left and right conditions. - enum: - AND: The condition is true if both the left and right sides are true. - OR: The condition is true if either the left or right side is true. - ONE-OF: - name: customTaxRate | type: string | description: Percentage value to apply as a custom tax rate. Range: [0-100]. - name: taxGroupId | type: string | description: Tax group GUID. Internal only. - name: _id | type: string | description: Rule GUID. - name: locationId | type: string | description: Business location GUID ([SDK](https://dev.wix.com/docs/sdk/backend-modules/restaurants/wix-restaurants-new/about-business-locations.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/restaurants/wix-restaurants-new/about-business-locations.md)) of the rule. - name: name | type: string | description: Rule name. - name: _createdDate | type: Date | description: Date and time the rule was created. - name: _updatedDate | type: Date | description: Date and time the rule was updated. - name: conditionType | type: ConditionType | description: Specifies the type of condition. - enum: - UNDEFINED_CONDITION_TYPE: Indicates that the Rule has no conditions specified. - CONDITION: Indicates that the Rule has a single Condition. - CONDITION_TREE: Indicates that the Rule has a complex condition specified as a ConditionTree. - name: enabled | type: boolean | description: Whether the rule is enabled. If `true`, the rule is evaluated when service fees are calculated. If `false`, the rule will not be evaluated when service fees are calculated. - name: revision | type: string | description: Revision number. Increments by 1 each time the rule is updated. To prevent conflicting changes, the existing `revision` must be used when updating a rule. - name: appId | type: string | description: Defines the app that the rule is connected to. - name: roundingStrategy | type: RoundingStrategy | description: Rounding strategy to apply to fee and tax calculation. - enum: - HALF_UP: Rounds up any number exactly halfway between two integers. For example, `2.5` rounds to `3`, and `3.5` and rounds to `4`. - HALF_EVEN: Rounds such numbers to the nearest even integer. For example, `2.5` rounds to `2`, but `3.5` rounds to `4`. - name: extendedFields | type: ExtendedFields | description: Data Extensions - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: Tags ([SDK](https://dev.wix.com/docs/sdk/backend-modules/tags/tags/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-management/tags/introduction.md)) used to classify and sort different types of rules. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. ``` ### Examples ### getRule ```javascript import { serviceFees } from '@wix/restaurants'; async function getRule(ruleId) { const response = await serviceFees.getRule(ruleId); }; ``` ### getRule (with elevated permissions) ```javascript import { serviceFees } from '@wix/restaurants'; import { auth } from '@wix/essentials'; async function myGetRuleMethod(ruleId) { const elevatedGetRule = auth.elevate(serviceFees.getRule); const response = await elevatedGetRule(ruleId); } ``` ### getRule (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { serviceFees } from '@wix/restaurants'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { serviceFees }, // Include the auth strategy and host as relevant }); async function getRule(ruleId) { const response = await myWixClient.serviceFees.getRule(ruleId); }; ``` ---