---
title: Payments
description: Paid checkout flow via Platform API and confirmation URL.
---

# Payments

## Flow

```text
1. User selects a paid plan_price on the paywall
2. App calls createPayment(plan_price_id, return_url)
3. API creates provider payment + pending Platform payment row
4. App opens confirmation_url
5. Provider webhook → Platform marks succeeded → grants entitlements / subscription period
6. App refreshes entitlements (and updates local cache)
```

## Client rules

- Require auth JWT + public key
- Never send provider secrets from the client
- Do not call createPayment for free prices
- After return, call `getMyEntitlements()` again

## Response (paid)

```json
{
  "data": {
    "payment_id": "uuid",
    "provider_payment_id": "…",
    "status": "pending",
    "confirmation_url": "https://…",
    "amount": 1490,
    "currency": "RUB",
    "requires_purchase": true
  }
}
```

## Free attempt

```json
{
  "error": "free_plan_offline",
  "is_free": true,
  "requires_purchase": false,
  "works_offline": true
}
```

## Display discount

`discount_percent` is cosmetic. Charged amount is always `amount`. Strike-through uses `compare_at_amount`.
