> 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 # CheckBenefitEligibility # Package: benefitPrograms # Namespace: PoolService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/check-benefit-eligibility.md ## Permission Scopes: Manage benefit programs: SCOPE.BENEFIT_PROGRAMS.MANAGE ## Introduction Checks if a benefit can currently be redeemed. To be redeemed, a benefit's pool must be active and the associated balance must be greater than the cost of the benefit. --- ## REST API ### Schema ``` Method: checkBenefitEligibility Description: Checks if a benefit can currently be redeemed. To be redeemed, a benefit's pool must be active and the associated balance must be greater than the cost of the benefit. URL: https://www.wixapis.com/benefit-programs/v1/pools/check-eligibility Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: poolId, itemReference, itemReference.externalId, itemReference.providerAppId, namespace Method parameters: param name: additionalData | type: additionalData | description: Additional information. param name: beneficiary | type: IdentificationData - ONE-OF: - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site. - name: memberId | type: string | description: GUID of a site member. - name: wixUserId | type: string | description: GUID of a Wix user. param name: benefitKey | type: benefitKey | description: Key of the benefit to check. param name: count | type: count | description: Amount of items to check. Ensures the balance is high enough to redeem this many items. param name: itemReference | type: ItemReference | required: true - name: externalId | type: string | description: External GUID of the item. | required: true - name: category | type: string | description: Item category. - name: providerAppId | type: string | description: GUID of the app providing the item. | required: true param name: namespace | type: namespace | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. | required: true param name: poolId | type: poolId | description: GUID of the pool that the benefit to check belongs to. | required: true param name: targetDate | type: targetDate | description: Date that the item will be provided to the beneficiary. This parameter should be used to manage the potential logistics of providing the item. Return type: CheckBenefitEligibilityResponse - name: result | type: EligibilityCheckResult | description: Result of the eligibility check. - name: benefitResults | type: array | description: Eligibility status. - ONE-OF: - name: eligibleBenefitOptions | type: EligibleBenefit | description: Returned when item is eligible to be redeemed. - name: poolId | type: string | description: Pool GUID. - name: benefitKey | type: string | description: Benefit key. - name: itemReference | type: ItemReference | description: Item reference. - name: externalId | type: string | description: External GUID of the item. - name: category | type: string | description: Item category. - name: providerAppId | type: string | description: GUID of the app providing the item. - name: price | type: string | description: Price of the benefit in credits. - name: notEnoughBalanceOptions | type: NotEnoughBalance | description: Returned when the pool's associated balance is lower than the cost of redeeming the items. - name: poolId | type: string | description: Pool GUID. - name: itemReference | type: ItemReference | description: Item reference. - name: availableBalance | type: string | description: Pool's associated balance amount in credits. - name: requestedBalance | type: string | description: Price of the item in credits. - name: policyExpressionEvaluatedToFalseOptions | type: PolicyExpressionEvaluatedToFalse | description: Returned when the policy is false. - name: poolId | type: string | description: Pool GUID. - name: itemReference | type: ItemReference | description: Item reference. - name: failureDetails | type: array | description: Failure details. - name: code | type: string | description: Failure code - name: message | type: string | description: Failure message - name: policyId | type: string | description: Policy id - name: appId | type: string | description: App that owns the policy - name: errorData | type: object | description: Information provided by the policy - name: poolNotActiveOptions | type: PoolNotActive | description: Returned when the pool isn't active. - name: poolId | type: string | description: Pool GUID. - name: poolStatus | type: PoolStatus | description: Pool status. - enum: - ACTIVE: Pool is active. - PAUSED: Pool is paused. It can be resumed. - ENDED: Pool is ended. It can't be resumed. - PROVISIONING: Pool provisioning is in progress. This status exists for a short time during processing. - RENEWING: Pool renewing is in progress. This status exists for a short time during processing. - PENDING: Pool is pending - name: benefitNotFoundOptions | type: BenefitNotFound | description: Returned when invalid benefit details are provided. - name: poolId | type: string | description: Pool GUID. - name: benefitKey | type: string | description: Specified benefit key. - name: poolNotFoundOptions | type: PoolNotFound | description: Returned when invalid pool details are provided. - name: poolId | type: string | description: Pool GUID. - name: type | type: Type | description: Eligibility status. - enum: - ELIGIBLE_BENEFIT: Item is eligible to be redeemed. - NOT_ENOUGH_BALANCE: Balance is lower than the cost of redeeming the items. - POOL_NOT_ACTIVE: Pool isn't active. - BENEFIT_NOT_FOUND: Invalid benefit details provided. - POOL_NOT_FOUND: Invalid pool details provided. ``` ### Examples ### CheckBenefitEligibility ```curl ~~~cURL curl --request POST https://www.wixapis.com/benefit-programs/v1/pools/check-eligibility \ -H "Authorization: " \ -H "Content-Type: application/json" \ --data '{ "item_reference": { "external_id": "57273802-b873-495c-8eba-b8f054452e6c", "provider_app_id": "00000000-0000-0000-0000-000000000000" }, "count": 3, "beneficiary": { "identity_type": "MEMBER", "member_id": "00000000-0000-0000-0000-000000000000" }, "namespace": "benefit_programs_app", "pool_id": "4a4de95d-867a-4089-98a8-83af77e38eca" }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.benefitPrograms.PoolService.checkBenefitEligibility(poolId, options) Description: Checks if a benefit can currently be redeemed. To be redeemed, a benefit's pool must be active and the associated balance must be greater than the cost of the benefit. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: poolId, options.itemReference, options.itemReference.externalId, options.itemReference.providerAppId, options.namespace, options Method parameters: param name: options | type: CheckBenefitEligibilityOptions none | required: true - name: benefitKey | type: string | description: Key of the benefit to check. - name: itemReference | type: ItemReference | description: Information about the item to check. | required: true - name: externalId | type: string | description: External GUID of the item. | required: true - name: category | type: string | description: Item category. - name: providerAppId | type: string | description: GUID of the app providing the item. | required: true - name: count | type: integer | description: Amount of items to check. Ensures the balance is high enough to redeem this many items. - name: targetDate | type: Date | description: Date that the item will be provided to the beneficiary. This parameter should be used to manage the potential logistics of providing the item. - name: additionalData | type: object | description: Additional information. - name: beneficiary | type: IdentificationData | description: Beneficiary of the pool containing the benefit to check. - ONE-OF: - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site. - name: memberId | type: string | description: GUID of a site member. - name: wixUserId | type: string | description: GUID of a Wix user. - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. | required: true param name: poolId | type: string | description: GUID of the pool that the benefit to check belongs to. | required: true Return type: PROMISE - name: result | type: EligibilityCheckResult | description: Result of the eligibility check. - name: benefitResults | type: array | description: Eligibility status. - ONE-OF: - name: eligibleBenefitOptions | type: EligibleBenefit | description: Returned when item is eligible to be redeemed. - name: poolId | type: string | description: Pool GUID. - name: benefitKey | type: string | description: Benefit key. - name: itemReference | type: ItemReference | description: Item reference. - name: externalId | type: string | description: External GUID of the item. - name: category | type: string | description: Item category. - name: providerAppId | type: string | description: GUID of the app providing the item. - name: price | type: string | description: Price of the benefit in credits. - name: notEnoughBalanceOptions | type: NotEnoughBalance | description: Returned when the pool's associated balance is lower than the cost of redeeming the items. - name: poolId | type: string | description: Pool GUID. - name: itemReference | type: ItemReference | description: Item reference. - name: availableBalance | type: string | description: Pool's associated balance amount in credits. - name: requestedBalance | type: string | description: Price of the item in credits. - name: policyExpressionEvaluatedToFalseOptions | type: PolicyExpressionEvaluatedToFalse | description: Returned when the policy is false. - name: poolId | type: string | description: Pool GUID. - name: itemReference | type: ItemReference | description: Item reference. - name: failureDetails | type: array | description: Failure details. - name: code | type: string | description: Failure code - name: message | type: string | description: Failure message - name: policyId | type: string | description: Policy id - name: appId | type: string | description: App that owns the policy - name: errorData | type: object | description: Information provided by the policy - name: poolNotActiveOptions | type: PoolNotActive | description: Returned when the pool isn't active. - name: poolId | type: string | description: Pool GUID. - name: poolStatus | type: PoolStatus | description: Pool status. - enum: - ACTIVE: Pool is active. - PAUSED: Pool is paused. It can be resumed. - ENDED: Pool is ended. It can't be resumed. - PROVISIONING: Pool provisioning is in progress. This status exists for a short time during processing. - RENEWING: Pool renewing is in progress. This status exists for a short time during processing. - PENDING: Pool is pending - name: benefitNotFoundOptions | type: BenefitNotFound | description: Returned when invalid benefit details are provided. - name: poolId | type: string | description: Pool GUID. - name: benefitKey | type: string | description: Specified benefit key. - name: poolNotFoundOptions | type: PoolNotFound | description: Returned when invalid pool details are provided. - name: poolId | type: string | description: Pool GUID. - name: type | type: Type | description: Eligibility status. - enum: - ELIGIBLE_BENEFIT: Item is eligible to be redeemed. - NOT_ENOUGH_BALANCE: Balance is lower than the cost of redeeming the items. - POOL_NOT_ACTIVE: Pool isn't active. - BENEFIT_NOT_FOUND: Invalid benefit details provided. - POOL_NOT_FOUND: Invalid pool details provided. ``` ### Examples ### checkBenefitEligibility ```javascript import { pools } from '@wix/benefit-programs'; async function checkBenefitEligibility(poolId,options) { const response = await pools.checkBenefitEligibility(poolId,options); }; ``` ### checkBenefitEligibility (with elevated permissions) ```javascript import { pools } from '@wix/benefit-programs'; import { auth } from '@wix/essentials'; async function myCheckBenefitEligibilityMethod(poolId,options) { const elevatedCheckBenefitEligibility = auth.elevate(pools.checkBenefitEligibility); const response = await elevatedCheckBenefitEligibility(poolId,options); } ``` ### checkBenefitEligibility (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 { pools } from '@wix/benefit-programs'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { pools }, // Include the auth strategy and host as relevant }); async function checkBenefitEligibility(poolId,options) { const response = await myWixClient.pools.checkBenefitEligibility(poolId,options); }; ``` ---