> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fype.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Ab testing

# Subscription Growth: Offerings, Paywalls & A/B Testing

Fype provides features to optimize conversion rates, manage trial paywalls, customize pricing models, and run server-side A/B experiments.

***

## Catalog Presentation Layer

Fype decouples the billing catalog from checkout UI delivery. You define products, packages, offerings, and paywalls once. Fype resolves what to show the user dynamically at checkout.

```mermaid theme={null}
graph TD
    Offering[Offering e.g., default_sale] -->|groups| Package[Package e.g., monthly_bundle]
    Package -->|contains| Product[Product e.g., Pro Suite]
    Paywall[Paywall Layout Config] -->|linked to| Offering
```

### 1. Offerings

An **Offering** represents a curated list of Packages to display to a customer. Offerings are chosen dynamically using targeting rules or experiments.

* **Endpoint**: `POST /offerings`

### 2. Packages

A **Package** maps products into customer-facing billing bundles (e.g. Monthly, Yearly, or Lifetime bundles).

* **Endpoint**: `POST /packages`

### 3. Paywalls

A **Paywall** contains layout templates (`simple`, `feature_comparison`, `sliding_cards`) and visual configurations. The Fype checkout console uses this configuration to render the payment page dynamically.

* **Endpoint**: `POST /paywalls`

***

## Dynamic Resolution & Targeting Rules

When a customer triggers a checkout session, Fype resolves the correct paywall layout and offering variant.

* **Endpoint**: `POST /v1/offerings/resolve`
* **Request Parameters**:
  * `customer_id`: Mapped customer UUID.
  * `attributes`: Custom dictionary containing segment tags (e.g. `{"country": "IN", "platform": "ios"}`).

### Rule-Based Targeting

Fype's targeting engine checks customer tags against active experiment targeting conditions:

* **Exact match**: `{"country": "IN"}`
* **List check**: `{"platform": ["ios", "android"]}`

### Deterministic SHA-256 Bucketing

If a customer matches a running experiment's rules, Fype's bucketing engine assigns them to a variant cohort using a deterministic hashing algorithm:

1. Concatenates the Experiment ID and Customer ID: `"{experiment_id}:{customer_id}"`.
2. Computes the SHA-256 hash of the string.
3. Converts the hash modulo 100 to a bucket integer `[0-99]`.
4. Stably sorts variants by ID and allocates the customer to the corresponding traffic range.
5. Saves a sticky enrollment record so the customer is locked into the same paywall variant across future sessions.

***

## Bayesian Experiment Analytics

Fype automatically measures conversion rates between variant cohorts to determine which pricing models perform best.

* **Endpoint**: `GET /experiments/{id}/results`

### Chance to Win Metrics

When you retrieve experiment results, Fype parses cohort metrics (visitors, conversions, revenue, trial starts) using a Bayesian evaluator.

* **Chance to Win**: The statistical probability of a treatment variant outperforming the control variant.
* **MRR Lift**: Revenue improvement confidence intervals.
* **Decision Engine**: Automatically flags a variant as the "Winner" once it meets confidence limits.
