> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/sample-flows.md

## Article Content:

# Pools API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Show a beneficiary which benefits they can redeem

When a beneficiary views an item in your app or site, you can show them which benefits they can currently redeem for that item across all of their pools, without performing a redemption. This lets the beneficiary choose where to redeem from before committing.

> **Prerequisite:** The site must have the Pricing Plans app installed.

To show a beneficiary the benefits they can redeem and let them redeem one:

1. Call [Check Benefit Eligibility By Filter](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/check-benefit-eligibility-by-filter.md) with the beneficiary, the `itemReference` of the item in question, the `count` of items to check, and a `poolSelector` with `poolStatuses` set to `ACTIVE` to narrow the check to the beneficiary's active pools.
1. For each returned result, read `benefitResults` and display the benefits whose `type` is `ELIGIBLE_BENEFIT` as available to redeem. You can optionally surface ineligible results, such as `NOT_ENOUGH_BALANCE`, to explain why a benefit can't be redeemed.
1. When the beneficiary selects a benefit to redeem, call [Redeem Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/redeem-benefit.md) with the `poolId` and `benefitKey` from the chosen eligible benefit. This records the redemption and adjusts the pool's associated balance.

## Change the date of a redeemed benefit

After a beneficiary redeems a benefit for an item on a specific date, they may need to receive the item on a different date instead. Reallocating the redemption moves it to the new date without charging the pool's balance again.

> **Prerequisite:** The site must have the Pricing Plans app installed.

To change the date of a redeemed benefit:

1. When you redeem the benefit, call [Redeem Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/redeem-benefit.md) with the item's original `targetDate`, and store the returned `transactionId` with your record of the redemption.
1. When the beneficiary chooses a new date, call [Reallocate Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/reallocate-benefit.md) with the stored `transactionId`, the new `targetDate`, the same `beneficiary` and `namespace` you used for the redemption, and a new `idempotencyKey`.
1. Replace the stored `transactionId` with the `transactionId` returned by Reallocate Benefit. Use this ID the next time you reallocate or cancel this redemption.

## Undo a redemption

If an item the beneficiary redeemed a benefit for is no longer provided, for example because the beneficiary canceled it, you can undo the redemption. Canceling the redemption credits the redeemed amount back to the pool's balance, so the beneficiary can redeem it again.

> **Prerequisite:** The site must have the Pricing Plans app installed.

To undo a redemption:

1. Retrieve the `transactionId` you stored for the redemption. This is the ID returned by [Redeem Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/redeem-benefit.md) or, if the redemption was reallocated, by the last call to [Reallocate Benefit](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/reallocate-benefit.md).
1. Call [Cancel Redemption](https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/cancel-redemption.md) with the `transactionId` and a new `idempotencyKey`. If the call fails with a `NOT_LATEST_TRANSACTION` error, call Cancel Redemption again with the `latestTransactionId` from the error details.