> 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 # GetEligibleBenefits # Package: benefitPrograms # Namespace: PoolService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/get-eligible-benefits.md ## Permission Scopes: SCOPE.BENEFIT_PROGRAMS.READ (PII): SCOPE.BENEFIT_PROGRAMS.READ_LIMITED ## Introduction Retrieves benefits that can be redeemed for a specific benefit item. Each benefit item can only be linked to 1 benefit in 1 pool definition. However, each pool created from that pool definition contains the same benefits. This method checks each pool containing a benefit with this benefit item, and returns the benefits that can be redeemed. --- ## REST API ### Schema ``` Method: getEligibleBenefits Description: Retrieves benefits that can be redeemed for a specific benefit item. Each benefit item can only be linked to 1 benefit in 1 pool definition. However, each pool created from that pool definition contains the same benefits. This method checks each pool containing a benefit with this benefit item, and returns the benefits that can be redeemed. URL: https://www.wixapis.com/benefit-programs/v1/pools/eligible-pools Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: 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: count | type: count | description: Amount of items to check. This 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: 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: GetEligibleBenefitsResponse - name: eligibleBenefits | type: array | description: Retrieved benefits that can 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. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_ITEM_REFERENCE | Description: Invalid item reference values. ``` ### Examples ### GetEligibleBenefits ```curl ~~~cURL curl --request POST https://www.wixapis.com/benefit-programs/v1/pools/eligible-pools \ -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" }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.benefitPrograms.PoolService.getEligibleBenefits(itemReference, options) Description: Retrieves benefits that can be redeemed for a specific benefit item. Each benefit item can only be linked to 1 benefit in 1 pool definition. However, each pool created from that pool definition contains the same benefits. This method checks each pool containing a benefit with this benefit item, and returns the benefits that can be redeemed. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: itemReference, itemReference.externalId, itemReference.providerAppId, options.namespace, options Method parameters: 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: options | type: GetEligibleBenefitsOptions none | required: true - name: count | type: integer | description: Amount of items to check. This 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: Filter request by beneficiary. - 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 Return type: PROMISE - name: eligibleBenefits | type: array | description: Retrieved benefits that can 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. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_ITEM_REFERENCE | Description: Invalid item reference values. ``` ### Examples ### getEligibleBenefits ```javascript import { pools } from '@wix/benefit-programs'; async function getEligibleBenefits(itemReference,options) { const response = await pools.getEligibleBenefits(itemReference,options); }; ``` ### getEligibleBenefits (with elevated permissions) ```javascript import { pools } from '@wix/benefit-programs'; import { auth } from '@wix/essentials'; async function myGetEligibleBenefitsMethod(itemReference,options) { const elevatedGetEligibleBenefits = auth.elevate(pools.getEligibleBenefits); const response = await elevatedGetEligibleBenefits(itemReference,options); } ``` ### getEligibleBenefits (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 getEligibleBenefits(itemReference,options) { const response = await myWixClient.pools.getEligibleBenefits(itemReference,options); }; ``` ---