# Stream App API Documentation > Complete API documentation and guides for Stream App ## Quick Start for LLMs > Read this section first. It is written for AI agents and coding assistants integrating with Stream (streampay.sa), a Saudi payment platform for payment links, invoices, subscriptions, installments, coupons, and a hosted customer billing portal. Everything below is derived from the guides and API reference listed in the Table of Contents further down. ### Mental model (read before writing any code) - **Default flow:** Your server -> `POST /api/v2/payment_links` -> redirect the customer (or embed) to the returned `url` -> Stream hosted checkout -> customer lands on your `success_redirect_url` / `failure_redirect_url` -> **you verify server-side** and/or receive webhooks. - **Payment links are the recommended way to collect money.** The invoice and subscription create endpoints say so themselves: "For most use cases, use the Checkout/Payment Link API instead." Do not default to `POST /invoices` or `POST /subscriptions`. - **Entities are created only after a successful payment.** A paid link creates: - one-time products -> an **invoice** + **payment(s)** - recurring products -> a **subscription** + initial **invoice** + **payment** - A failed attempt creates nothing (no invoice, payment, or subscription). - **Recurrence lives on the product, not the link.** Create the product as one-time or recurring first, then reference it by `product_id`. - **"Consumer" = "customer".** The API says consumer; the dashboard says customer. The consumer `id` is what you pass as `organization_consumer_id`. ### Base URL and authentication - Base URL: `https://stream-app-service.streampay.sa/api/v2` - Header on every request: `x-api-key: ` - Build the token: `echo -n 'api-key:api-secret' | base64` - Create the key pair in the dashboard under Settings -> API Keys. The secret is shown at creation; store it like a password. - Never put the key pair or token in browser/mobile code. All calls go through your backend. - Optional header `x-branch-id: ` selects the branch. If omitted, the key's default branch is used. Keys only reach branches they were granted (or all branches if created with `is_all_branches`). Unauthorized branch -> 4xx. - The MCP server uses a different header: `Authorization: Bearer ` (see MCP section). ### The five-step integration **1. (Optional) Create a consumer** - `POST /api/v2/consumers` Only `name` is required. Recommended: `phone_number` (E.164, e.g. `+966501234567`) or `email` so Stream can notify them, plus `external_id` for your own ID. ```bash curl -X POST https://stream-app-service.streampay.sa/api/v2/consumers \ -H "x-api-key: $STREAM_TOKEN" -H "Content-Type: application/json" \ -d '{"name":"Ahmad Ali","email":"ahmad@example.com","phone_number":"+966501234567","external_id":"cust_12345"}' ``` Returns the consumer; keep `id`. Duplicate phone/email -> `DUPLICATE_CONSUMER`: list consumers and reuse the existing `id`. **2. Have a product** - `POST /api/v2/products` (one-time or recurring). Keep its `id`. A product can hold one active price per currency (`POST /products/{product_id}/prices` adds another currency). **3. Create the payment link** - `POST /api/v2/payment_links` ```bash curl -X POST https://stream-app-service.streampay.sa/api/v2/payment_links \ -H "x-api-key: $STREAM_TOKEN" -H "Content-Type: application/json" \ -d '{ "name": "Order 789", "items": [{"product_id": "PRODUCT_UUID", "quantity": 1}], "contact_information_type": "PHONE", "currency": "SAR", "max_number_of_payments": 1, "organization_consumer_id": "CONSUMER_UUID", "success_redirect_url": "https://example.com/success", "failure_redirect_url": "https://example.com/failure", "custom_metadata": {"order_id": "789"} }' ``` - Response includes `url`, `id`, `status` (e.g. `ACTIVE`), `amount` (decimal string like `"2500.00"`), `currency`. Redirect the customer to `url`. - Omit `organization_consumer_id` for a shareable link: each payer enters their own details and a consumer is auto-created. Use a higher `max_number_of_payments` for these (docs example: 100). - Set `organization_consumer_id` + `max_number_of_payments: 1` for a link tied to one known customer; the checkout skips the details form. **4. Handle the redirect, then verify.** Stream appends query params (`status`, `message`, `payment_link_id`, and on success `invoice_id`, `payment_id`, `consent_id`, `organization_consumer_id`). **Do not trust them.** Fetch `GET /api/v2/invoices/{invoice_id}` and check `status`, `amount`, `currency` against your own order before fulfilling. **5. Confirm asynchronously with webhooks** (recommended) and/or poll `GET /api/v2/payments/{id}` and `GET /api/v2/subscriptions/{id}`. The `status` field on the fetched object is the source of truth. ### Embedded checkout (instead of redirect) Create the payment link on your server, pass only the `url` to the page: ```html
``` Optional: `minHeightPx` (280), `maxHeightPx` (920), `vhCapPx` (800), `vhFraction` (0.7). Apple Pay in embedded mode requires hosting Stream's domain-association file at `/.well-known/apple-developer-merchantid-domain-association` on your domain and contacting Stream support to register you. ### Webhooks in 60 seconds - Register endpoints in the dashboard (Settings -> Webhooks) and pick event types. There is also a `POST /api/v2/webhooks` endpoint. - Body shape: `event_type`, `entity_type`, `entity_id`, `entity_url`, `status`, `data`, `timestamp`. `data.metadata` echoes your `custom_metadata`. - Headers: `X-Webhook-Event`, `X-Webhook-Entity-Type`, `X-Webhook-Entity-ID`, `X-Webhook-Timestamp`, `X-Webhook-Signature` (`t={timestamp},v1={signature}`). - **Verify the signature:** HMAC-SHA256 over the exact string `"{timestamp}.{raw_request_body}"` using the webhook's `secret_key`, hex digest, constant-time compare to `v1`. Use the **raw bytes** of the body, not re-serialized JSON. ```python import hmac, hashlib def verify(secret: str, raw_body: bytes, header: str) -> bool: parts = dict(p.split("=", 1) for p in header.split(",")) msg = f"{parts['t']}.{raw_body.decode()}" expected = hmac.new(secret.encode(), msg.encode(), hashlib.sha256).hexdigest() return hmac.compare_digest(expected, parts["v1"]) ``` - Respond with any 2xx quickly. Non-2xx triggers up to 5 retries at roughly 5 min, 30 min, 2 h, 6 h, 12 h; after that the delivery is marked failed. ### Testing - Use the sandbox environment with Moyasar test cards. Name: any two words. Expiry: any future date. CVC: any 3 digits (4 for AMEX). - Success: Mada `4201320111111010`, Visa `4111111111111111`, Mastercard `5421080101000000`, AMEX `340000000900000`. - Insufficient funds: Mada `4201320000311101`, Visa `4123120001090000`, Mastercard `5457210001000092`, AMEX `340033000000000`. - Generic decline: Mada `4201321234411220`, Visa `4123120001090109`. - 3DS failure cases exist for Visa only (see Testing Cards guide). - **Apple Pay in sandbox is driven by amount:** 200.00-300.00 SAR succeeds; 1000.00-1700.00 SAR hits assorted failures; **any other amount fails.** Do not use random amounts when testing Apple Pay. --- ## Tips and Tricks for LLMs ### Hard rules (violating these causes real bugs or lost money) 1. **Never mix one-time and recurring products in one payment link.** Split into two links tied to one internal order (store a shared order reference in `custom_metadata` or your DB), run them sequentially, and mark the order complete only after both succeed. 2. **Never fulfill an order from redirect query params alone.** Verify via `GET /invoices/{invoice_id}` (status, amount, currency) or a verified webhook. 3. **Never expose the key pair, the Base64 token, or a webhook `secret_key` client-side.** Embedded checkout only needs the link `url`. 4. **Always verify `X-Webhook-Signature`** and reject missing or invalid ones. 5. **Make webhook handlers idempotent.** Retries and multi-event flows mean you will see duplicates and out-of-order delivery. Key on `entity_id` + `event_type`. 6. **Do not use the redirect `id` param as a Stream ID.** It is the payment gateway's ID, for support debugging only. Use `payment_id` or `invoice_id`. ### Choosing the right endpoint | Goal | Use | |---|---| | Collect a one-off payment | `POST /payment_links` with one-time product(s) | | Start a subscription | `POST /payment_links` with recurring product(s) | | Take payment via your own page | `POST /payment_links` + Embedded Checkout | | Record money received offline (cash, bank transfer, etc.) | Create invoice, then `POST /payments/{id}/mark-paid` | | Send customer to self-service billing | `POST /consumer_portal/sessions` | | Charge a saved card on demand | `POST /payments/auto-charge-on-demand/{payment_id}` (restricted; only some orgs) | | Pause billing | `POST /subscriptions/{id}/freeze` | | Reverse a payment | `POST /payments/{id}/refund` | ### Consumers - Check for an existing consumer before creating one (match by `external_id`, or `GET /consumers?search_term=...`) to avoid `DUPLICATE_CONSUMER`. - Phone numbers must be E.164. `+966501234567`, not `0501234567`. - `communication_methods` accepts `WHATSAPP`, `EMAIL`, `SMS`. Provide at least a phone or email, otherwise Stream cannot notify the customer. - `DELETE` on a consumer is a soft delete (`is_deleted`). ### Payment links - `contact_information_type` is `PHONE` or `EMAIL` (shown in docs examples) and controls which contact the checkout collects/uses for login. - Put your own references in `custom_metadata` (arbitrary JSON, nested allowed). It comes back in webhook `data.metadata`, which is the cleanest way to join Stream events to your orders. - `language=en` or `language=ar` as a query param on the link URL switches the checkout UI language only. Default is Arabic (or the org's configured language). - Installments: pass `payment_methods: {"installment": true|false}` on the link to override the org default. Omit `payment_methods` to inherit the org setting. - Link coupons and status are managed after creation with `PATCH`-style endpoints: Update Payment Link Coupons, Update Payment Link Status. To retire a link, update its status rather than deleting. - Failed payment-link attempts produce **no** invoice/payment/subscription. To catch these, subscribe to `PAYMENT_LINK_PAY_ATTEMPT_FAILED`, not `PAYMENT_FAILED`. - Redirect `status` values: `paid`, `pending`, `failed`, `failed_internal_error`. `failed` = definite decline, let the payer retry. `failed_internal_error` = unclear (timeout etc.); money may or may not have moved, so tell the payer to contact support and reconcile via the API before retrying or refunding. ### Installments - Customers choose 2, 3, or 4 installments at checkout. **Installments are disabled automatically for recurring products.** - Each installment is its own payment with its own due date. Default split period is monthly; it cannot be changed via API or dashboard (contact support). - Minimum is **100 SAR per installment**. A 250 SAR order allows 2 installments but not 3. This minimum is also support-only to change. - Rounding remainder goes to the **last** installment (999.98 / 3 -> 333.33, 333.33, 333.32). - Webhooks: one `PAYMENT_SUCCEEDED` per installment paid; `INVOICE_COMPLETED` only fires once **every** installment is paid. - Invoice-level installment settings are configured in the dashboard (invoices are created from the UI per the guide); payment-link defaults live in Settings -> Payment Settings. ### Subscriptions - Cancel (`POST /subscriptions/{id}/cancel`): an `ACTIVE` subscription is **scheduled to cancel at period end** and stays active until then. `INACTIVE`, `TRIALING`, and `TRIAL_PENDING` subscriptions cancel **immediately**. Pass `cancel_related_invoices` to also cancel ongoing invoices. Undo a pending cancellation with the Uncancel endpoint. - Update (`PUT /subscriptions/{id}`): - Items, subscription-level coupons, and recurring interval changes are **deferred to `current_period_end`** as a "pending change". The response includes `pending_change` with `next_invoice_preview` and a per-line diff. - If the next-cycle invoice already exists and is unpaid, it is cancelled and reissued at the new amount. - Description, auto-cancel cycle count (`until cycle number`), and payment-method overrides apply **immediately**. - You cannot change the payer. Cancel and create a new subscription instead. - Revert a scheduled change with `DELETE /subscriptions/{id}/pending-change` (returns 200 even if nothing was scheduled). - Freeze pauses **invoice generation** for a date range and auto-resumes afterward. Freezes have their own list / update / delete endpoints. - Renewal webhook sequence: `INVOICE_CREATED` -> `PAYMENT_SUCCEEDED` -> `INVOICE_COMPLETED` (plus `SUBSCRIPTION_CYCLE_RENEWED_SUCCESSFULLY`). On `INVOICE_COMPLETED`, check `subscription_id` in the payload to recognize a renewal. Failed automatic renewals emit `SUBSCRIPTION_CYCLE_RENEWAL_FAILED`. - Plan-change event family: `SUBSCRIPTION_PLAN_CHANGE_SCHEDULED` (deferred), `..._CHANGED` (deferred change applied), `..._CHANGE_CANCELED`, `..._CHANGE_INVOICE_REISSUED`, and `SUBSCRIPTION_PLAN_UPDATED` (immediate change such as seats, add-ons, cycle count). ### Payments, refunds, and manual payments - Multiple refunds per payment are supported. Partial refund -> payment status `PARTIALLY_REFUNDED` + `PAYMENT_PARTIALLY_REFUNDED`. Cumulative total reaches the payment amount -> `REFUNDED` + `PAYMENT_REFUNDED`. **The invoice status does not change on refund.** Subscribe to both refund events if you handle partials. - Webhook refund payloads carry `amount_refunded` (this refund) and `total_amount_refunded` (cumulative). - If a payment belongs to a shared charge, set `payment_is_part_of_related_set: true` on the refund request to spread the refund across the related payments in invoice order. - Refund errors: `PAYMENT_REFUNDED_ALREADY` (duplicate, safe to treat as done), `PAYMENT_REFUNDED_FAILED` (processor failure, retryable later). - `mark-paid` supports methods `CASH`, `BANK_TRANSFER`, `CARD`, `QURRAH`. Omit `amount` (or equal to payment amount) for full. A partial amount reduces the original payment, marks it `SUCCEEDED`, and creates a new `PENDING` `SPLIT_REMAINDER` payment for the rest; the remainder must be more than 1 in the payment currency, and partial is not allowed while `UNDER_REVIEW`. The invoice completes only when every payment is paid. - Invoice in-place edits (`PATCH /invoices/{id}/inplace`) are for small changes such as description or scheduled date. A finalised invoice rejects actions with `INVOICE_FINALISED`. - Products and coupons used by a finalized invoice cannot be edited (`PRODUCT_USED_IN_FINALIZED_INVOICE`, `COUPON_USED_IN_FINALIZED_INVOICE`). Create a new one instead. Deleting a product price is a soft delete (archive). ### Lists, pagination, and filtering - Query params: `page` (starts at 1), `limit` (max 100), `sort_field` (default `created_at`), `sort_direction` (`asc`/`desc`, default `desc`), `search_term` (free text across names/IDs/descriptions). - Array filters repeat the key: `statuses=PENDING&statuses=PROCESSING`. In Python `requests`, pass a list. Resource-specific filters exist (e.g. `invoice_id` on payments). - Response: `{"data": [...], "pagination": {"total_count", "max_page", "current_page", "limit", "has_next_page", "has_previous_page"}}`. Loop on `has_next_page`; use `limit=100` to minimize calls. Note: the guide describes `total_count` as the count on the current page, so rely on `has_next_page` / `max_page` rather than assuming it is a global total. - When you apply filters, pagination metadata reflects the filtered set. ### Errors - Handled errors use `{"error": {"code": "...", "message": "...", "additional_info": "..."}}`. Branch on `code`, never on `message`. - Validation failures (HTTP 422) can instead return FastAPI-style `{"detail": [{"loc": [...], "msg": "...", "type": "..."}]}`. Handle **both** shapes. - Status mapping: 400 bad request, 401 unauthorized, 403 forbidden / permission, 404 not found, 410 gone, 422 unprocessable or duplicate. - Codes you should handle explicitly: `INVALID_PARAMETERS`, `DUPLICATE_CONSUMER`, `DUPLICATE_PAYMENT`, `PHONE_ALREADY_REGISTERED`, `INVOICE_FINALISED`, `PAYMENT_REFUNDED_ALREADY`, `PAYMENT_REFUNDED_FAILED`, `PERMISSION_FORBIDDEN`, `PRODUCT_USED_IN_FINALIZED_INVOICE`, `COUPON_USED_IN_FINALIZED_INVOICE`, `STREAM_ERROR`, `STREAM_UNKNOWN_ERROR`. On `STREAM_ERROR` / `STREAM_UNKNOWN_ERROR`, log `additional_info` and escalate to support rather than blind-retrying a money-moving call. ### Customer portal - Backend calls `POST /api/v2/consumer_portal/sessions` with `organization_consumer_id` (HTTP 201 -> `url`). The token is **short-lived and single-use**, so generate a fresh session each time the customer clicks "Manage billing". Do not cache or email the URL. - Optional body fields: `return_url` (a back-link hint only; Stream does **not** auto-redirect) and `subscription_id` (open directly on one subscription). The URL can be used for a redirect or an iframe. - The portal can only offer plan switches and add-ons if the dashboard catalog is configured: **product switch groups** (only members of the same group can replace each other; mixed MONTHLY/YEARLY allowed) and **add-on mappings** (which base products make an add-on eligible), plus the Customer Portal permission toggles. If the portal shows nothing to switch, the cause is configuration, not the API. - Subscriptions with subscription-level coupons generally cannot be edited from the portal. Proration is computed by Stream and excludes the current day; do not reimplement it. ### Handling your own customer notifications By default Stream notifies consumers (confirmations, invoice updates, subscription changes). To own all messaging: (1) ask Stream support to enable the setting that blocks default consumer notifications, (2) use webhooks for event-driven messages, (3) poll the List Payments / Invoices / Subscriptions endpoints with filters for scheduled messages like reminders and overdue notices. You cannot self-serve step 1. ### Branches Requests are scoped to one branch. Use `x-branch-id` to target a branch; without it the key's default branch is used. If resources seem "missing", you are probably querying the wrong branch. ### MCP server (for AI agents) - Hosted at `https://mcp.streampay.sa/mcp`. Config key `"url"`, plus `"headers": {"Authorization": "Bearer "}` for operational tools. - The resource `stream://docs/openapi` exposes the **full, current OpenAPI spec and needs no API key**. Read it before guessing request fields; this documentation set links endpoint pages whose rendered Markdown does not include the full request/response schemas. - Tool groups: payment links, customers, products, coupons, invoices (create, list, get, send, void), payments (list, get, refund). Tool names (e.g. `create_payment_link`, `refund_payment`) are not the same as REST paths. Note that some MCP descriptions (for example ZATCA-compliant invoices) are tool-level descriptions, so confirm behavior in the OpenAPI spec. ### SDKs TypeScript SDK (`StreamSDK.init(process.env.STREAM_API_KEY!)`) and an Express SDK (a `Checkout({ apiKey, ... })` route handler). Full docs live in their GitHub repositories, linked at the bottom of the Table of Contents. SDKs take the same `x-api-key` token. ### Gotchas and doc inconsistencies to be aware of - **The Installments link in the Table of Contents is malformed** (`https://docs.streampay.sa/docs/guides/installments.md`). The correct path is most likely `https://docs.streampay.sa/docs/guides/installments.md`. The installment facts above come from the same guide as published in the developer-docs full export. - The Authentication guide says "HTTP Basic Authentication" but the actual mechanism is the **`x-api-key` header carrying the Base64 token**, not an `Authorization: Basic` header. Use `x-api-key`. - The Authentication guide's curl example posts `{"name","amount"}` to `/payment_links`; that is a placeholder. A real payment link requires `items` with `product_id`s, as in the Getting Started examples. - The Pagination guide's example hits `/api/v2/customers`; the real resource path is **`/api/v2/consumers`**. - The Branches guide example calls `/api/v2/user`; the identity endpoint listed in the API reference is "Get User And Organization Info" (`/api/v2/me`-style). Check the reference for the exact path. - The branch create path may differ between exports (`/api/v2/branch` vs the public reference's "Create Branch"). Confirm in the OpenAPI spec. - Sandbox vs production: the docs reference a sandbox environment and test cards but do not publish a separate sandbox base URL. Use the sandbox-mode key/dashboard Stream gives you, or ask support, rather than inventing a hostname. - Amounts in responses appear as **decimal strings in SAR** (e.g. `"2500.00"`). Compare as decimals, not floats. - When unsure about a field name, enum value, or required property, do not guess. Read `stream://docs/openapi` via the MCP server or the endpoint's page in the Table of Contents. ### Suggested agent workflow for "add Stream payments to my app" 1. Ask which flow: one-time, subscription, installments, or embedded/redirect. Confirm whether the cart ever mixes one-time and recurring items. 2. Create (or look up) the product(s), and the consumer if the customer is known. 3. Create the payment link from the backend; return only `url` to the client. 4. Implement the success/failure routes: read `invoice_id`, call `GET /invoices/{id}`, check `status`/`amount`/`currency`, then fulfill. 5. Implement the webhook endpoint with raw-body signature verification, idempotency, and fast 2xx. Subscribe to at minimum `PAYMENT_SUCCEEDED`, `PAYMENT_FAILED`, `INVOICE_COMPLETED`, plus `PAYMENT_PARTIALLY_REFUNDED` / `PAYMENT_REFUNDED` and the `SUBSCRIPTION_*` events if you sell subscriptions. 6. Test with the sandbox cards above (and Apple Pay amount ranges) before going live. --- ## Table of Contents - [Getting Started with Stream](https://staging-docs.streampay.sa/docs/guides/GETTING_STARTED.md) - [Pagination & Filtering](https://staging-docs.streampay.sa/docs/guides/pagination-and-filtering.md): Pagination helps you efficiently navigate, sort, and filter large collections of data without fetching everything at once. - [Webhooks](https://staging-docs.streampay.sa/docs/guides/webhooks.md) - [Testing Cards](https://staging-docs.streampay.sa/docs/guides/testing-cards.md): In order to test your application without having to go live with cards and accounts, you can use [Moyasar's testing cards](https://docs.moyasar.com... - [Installments](https:/staging-docs.streampay.sa//docs/guides/installments.md) - [Authentication](https://staging-docs.streampay.sa/docs/guides/authentication.md) - [Branches in the API](https://staging-docs.streampay.sa/docs/guides/branches.md): API requests are always scoped to a single branch. When creating an API key, you specify which branches it can access. For each request, you can se... - [Customer Portal (Hosted Billing)](https://staging-docs.streampay.sa/docs/guides/customer-portal.md) - [Embedded Checkout](https://staging-docs.streampay.sa/docs/guides/embedded-checkout.md): Render a payment link checkout in-page with the Stream Embed SDK. Create a payment link via the API first, then pass the response **`url`** into `p... - [Stream API Errors](https://staging-docs.streampay.sa/docs/guides/errors.md): This page documents the error response format and the standardized error codes returned by Stream API endpoints. The goal is to provide a stable, p... - [Handling Your Own Notifications](https://staging-docs.streampay.sa/docs/guides/handling-your-own-notifications.md) - [Stream MCP Server](https://staging-docs.streampay.sa/docs/guides/mcp-server.md): MCP (Model Context Protocol) is a standard way for AI clients to call tools and read resources from external systems. - [Add Product Price](https://staging-docs.streampay.sa/docs/api/v2-products-prices-add.md): Add a new price to a product in a different currency. - [Auto Charge On Demand](https://staging-docs.streampay.sa/docs/api/v2-payments-auto-charge-on-demand.md): Charge a payment using the consumer's latest tokenized card. - [Cancel an invoice](https://staging-docs.streampay.sa/docs/api/v2-invoices-cancel.md): Cancels an invoice and marks it as `CANCELED`. Use this when the invoice should no longer be collected or shown as payable. - [Cancel Scheduled Subscription Plan Change](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-pending-change-cancel.md): Cancel a previously-scheduled deferred plan change. - [Cancel Subscription](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-cancel.md): Schedule or complete cancellation and optionally cancel related invoices. - [Create Branch](https://staging-docs.streampay.sa/docs/api/v2-branches-create.md): Create a new branch for the organization. - [Create Consumer](https://staging-docs.streampay.sa/docs/api/v2-consumers-create.md): Create a new consumer with contact information and payment details. - [Create Coupon](https://staging-docs.streampay.sa/docs/api/v2-coupons-create.md): Create a new coupon with discount details and active/inactive status. - [Create Invite For A User To Join The Organization By Email](https://staging-docs.streampay.sa/docs/api/v2-organization-invite-create.md): Send an email invitation for a user to join the organization. - [Create Invoice](https://staging-docs.streampay.sa/docs/api/v2-invoices-create.md): Create a new invoice with items and payment details. - [Create Metered Subscription](https://staging-docs.streampay.sa/docs/api/v2-metered-subscriptions-create.md): Create a new metered subscription linking a METERED product to an organization consumer. The subscription is active immediately when its start time... - [Create Payment Link](https://staging-docs.streampay.sa/docs/api/v2-payment-links-create.md): Create a new checkout/payment link for collecting payments. - [Create a consumer portal session](https://staging-docs.streampay.sa/docs/api/v2-consumer-portal-sessions-create.md): Creates a short-lived, single-use portal session token for a merchant-owned consumer. The returned URL can be used to redirect the consumer or embe... - [Create Product](https://staging-docs.streampay.sa/docs/api/v2-products-create.md): Create a new product with pricing and description. - [Create Subscription](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-create.md): Create a new subscription with items, coupons, and payment methods. - [Deactivate Metered Subscription](https://staging-docs.streampay.sa/docs/api/v2-metered-subscriptions-deactivate.md): Deactivate a metered subscription by setting its end time to now. This subscription stops being billable after this exact time. Note: deactivated s... - [Delete Branch](https://staging-docs.streampay.sa/docs/api/v2-branches-delete.md): Delete a branch from the organization. - [Delete Consumer](https://staging-docs.streampay.sa/docs/api/v2-consumers-delete.md): Delete a consumer from the organization. - [Delete Coupon](https://staging-docs.streampay.sa/docs/api/v2-coupons-delete.md): Delete a coupon from the organization. - [Delete Product](https://staging-docs.streampay.sa/docs/api/v2-products-delete.md): Delete a product from the organization. - [Delete Product Price](https://staging-docs.streampay.sa/docs/api/v2-products-prices-delete.md): Archive (soft delete) a product price. - [Delete Subscription Freeze](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-unfreeze.md): Remove a freeze period from a subscription. - [Freeze Subscription](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-freeze.md): Freeze a subscription to pause invoice generation for a specific period. - [Get All Branches](https://staging-docs.streampay.sa/docs/api/v2-branches-list.md): List all branches for the organization. - [Get All Consumers](https://staging-docs.streampay.sa/docs/api/v2-consumers-list.md): List consumers with pagination, sorting, and optional filters. - [Get Branch By Id](https://staging-docs.streampay.sa/docs/api/v2-branches-get.md): Retrieve detailed information about a specific branch by its ID. - [Get Consumer](https://staging-docs.streampay.sa/docs/api/v2-consumers-get.md): Retrieve detailed information about a specific consumer by their ID. - [Get Coupon](https://staging-docs.streampay.sa/docs/api/v2-coupons-get.md): Retrieve detailed information about a specific coupon including redemption history. - [Get Invoice](https://staging-docs.streampay.sa/docs/api/v2-invoices-get.md): Retrieve detailed information about a specific invoice by its ID. - [Get Metered Subscription](https://staging-docs.streampay.sa/docs/api/v2-metered-subscriptions-get.md): Retrieve a metered subscription. - [Get Payment](https://staging-docs.streampay.sa/docs/api/v2-payments-get.md): Retrieve detailed information about a specific payment by its ID. - [Get Payment Link](https://staging-docs.streampay.sa/docs/api/v2-payment-links-get.md): Retrieve detailed information about a specific payment link by its ID. - [Get Product](https://staging-docs.streampay.sa/docs/api/v2-products-get.md): Retrieve detailed information about a specific product by its ID. - [Get Subscription](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-get.md): Retrieve detailed information about a specific subscription by its ID. - [Get User And Organization Info](https://staging-docs.streampay.sa/docs/api/v2-me-get.md): Retrieve information about the authenticated user and their organization. - [List Coupons](https://staging-docs.streampay.sa/docs/api/v2-coupons-list.md): List all coupons with pagination, filtering, and sorting options. - [List Invoices](https://staging-docs.streampay.sa/docs/api/v2-invoices-list.md): List all invoices with pagination, filtering, and sorting options. - [List Metered Subscriptions](https://staging-docs.streampay.sa/docs/api/v2-metered-subscriptions-list.md): List metered subscriptions. - [List Payment Links](https://staging-docs.streampay.sa/docs/api/v2-payment-links-list.md): List all payment links with pagination, filtering, and sorting options. - [List Payments](https://staging-docs.streampay.sa/docs/api/v2-payments-list.md): List all payments with pagination, filtering, and sorting options. - [List Products](https://staging-docs.streampay.sa/docs/api/v2-products-list.md): List products with pagination, sorting, and optional filters. - [List Subscription Freezes](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-freezes-list.md): List all freeze periods for a specific subscription. - [List Subscriptions](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-list.md): List all subscriptions with pagination, filtering, and sorting options. - [Mark Payment As Paid](https://staging-docs.streampay.sa/docs/api/v2-payments-mark-paid.md): Manually mark a payment as paid (full or partial). - [Record Metered Usage](https://staging-docs.streampay.sa/docs/api/v2-metered-meter-record.md): Record metered usage events in bulk - [Refund Payment](https://staging-docs.streampay.sa/docs/api/v2-payments-refund.md): Process a refund for a payment. - [Uncancel Subscription](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-uncancel.md): Withdraw a pending cancellation so the subscription continues after the current billing period. - [Update Branch](https://staging-docs.streampay.sa/docs/api/v2-branches-update.md): Update branch information. - [Update Consumer](https://staging-docs.streampay.sa/docs/api/v2-consumers-update.md): Update consumer information such as contact details or payment methods. - [Update Coupon](https://staging-docs.streampay.sa/docs/api/v2-coupons-update.md): Update coupon details such as discount amount or active status. - [Update Invoice In Place](https://staging-docs.streampay.sa/docs/api/v2-invoices-update-in-place.md): Partially update specific invoice fields in-place. - [Update Payment Link Coupons](https://staging-docs.streampay.sa/docs/api/v2-payment-links-update-coupons.md): Update link-level and item-level coupons on a payment link. - [Update Payment Link Status](https://staging-docs.streampay.sa/docs/api/v2-payment-links-update-status.md): Update the status of a payment link. - [Update Product](https://staging-docs.streampay.sa/docs/api/v2-products-update.md): Update product details such as name, price, or description. - [Update Product Price](https://staging-docs.streampay.sa/docs/api/v2-products-prices-update.md): Update a product price. - [Update Subscription](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-update.md): Update subscription items, coupons, billing interval, description, auto-cancel cycles, or payment methods. - [Update Subscription Freeze](https://staging-docs.streampay.sa/docs/api/v2-subscriptions-freeze-update.md): Update an existing subscription freeze period. - [Express SDK](https://staging-docs.streampay.sa/sdks/express.md): For the complete Express SDK documentation, please visit our GitHub repository: - [TypeScript SDK](https://staging-docs.streampay.sa/sdks/typescript.md): For the complete TypeScript SDK documentation, please visit our GitHub repository: