Retirement Lab Billing API

The billing API from Retirement Lab — 9 operation(s) for billing.

GitHub OpenAPI

Operations 9

GET /api/billing/catalog Billing Catalog #
POST /api/billing/checkout Create Checkout #
POST /api/billing/portal Create Portal #
POST /api/billing/sync Sync Subscription #
POST /api/billing/webhook Stripe Webhook #
POST /api/billing/store/app-store-notifications App Store Server Notification #
POST /api/billing/store/play-rtdn Play Real Time Developer Notification #
POST /api/billing/store/verify Verify Store Purchase #
POST /api/billing/store/restore Restore Store Purchases #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/retirementlab-app:retirementlab-app-billing-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

retirementlab-app-billing-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Income Simulator Billing API
  version: 0.1.0
tags:
- name: Billing
paths:
  /api/billing/catalog:
    get:
      tags:
      - Billing
      summary: Billing Catalog
      operationId: billing_catalog_api_billing_catalog_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BillingCatalogResponse'
  /api/billing/checkout:
    post:
      tags:
      - Billing
      summary: Create Checkout
      operationId: create_checkout_api_billing_checkout_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /api/billing/portal:
    post:
      tags:
      - Billing
      summary: Create Portal
      operationId: create_portal_api_billing_portal_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PortalResponse'
      security:
      - HTTPBearer: []
  /api/billing/sync:
    post:
      tags:
      - Billing
      summary: Sync Subscription
      description: 'Reconcile the caller''s subscription tier from Stripe and return the refreshed session.


        Fallback path after the Stripe Checkout redirect: if the webhook hasn''t

        delivered (or has been broken), the frontend calls this to force the backend

        to look up the user''s subscription directly from Stripe and update the DB.'
      operationId: sync_subscription_api_billing_sync_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BillingSyncRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthSessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /api/billing/webhook:
    post:
      tags:
      - Billing
      summary: Stripe Webhook
      operationId: stripe_webhook_api_billing_webhook_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
                title: Response Stripe Webhook Api Billing Webhook Post
  /api/billing/store/app-store-notifications:
    post:
      tags:
      - Billing
      summary: App Store Server Notification
      description: 'Consume Apple App Store Server Notifications v2.


        The notification envelope and nested transaction JWS must verify before any

        state changes. We then re-verify the transaction through the store verifier

        and only update an already-linked subscription row.'
      operationId: app_store_server_notification_api_billing_store_app_store_notifications_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppStoreNotificationRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
                title: Response App Store Server Notification Api Billing Store App Store Notifications Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/billing/store/play-rtdn:
    post:
      tags:
      - Billing
      summary: Play Real Time Developer Notification
      description: Consume Google Play RTDN Pub/Sub push notifications.
      operationId: play_real_time_developer_notification_api_billing_store_play_rtdn_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
                title: Response Play Real Time Developer Notification Api Billing Store Play Rtdn Post
  /api/billing/store/verify:
    post:
      tags:
      - Billing
      summary: Verify Store Purchase
      description: 'Verify a native purchase server-side and provision store-channel entitlement.


        Never trusts the client-reported purchase: the transaction is re-verified

        against Apple/Google before any entitlement is recorded. Blocks the purchase

        when an active Stripe subscription already provides Pro access (double-billing

        guard) and when the transaction belongs to another account.'
      operationId: verify_store_purchase_api_billing_store_verify_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreVerifyRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthSessionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
  /api/billing/store/restore:
    post:
      tags:
      - Billing
      summary: Restore Store Purchases
      description: 'Re-verify the caller''s prior store purchases and re-link them to the account.


        Reinstall / new-device flow: the client gathers its current store entitlements

        (StoreKit ``currentEntitlements`` / Play ``queryPurchases``) and sends them

        here; the server re-verifies each against the store and provisions the active

        ones. Idempotent — restoring an already-linked purchase does not duplicate it.'
      operationId: restore_store_purchases_api_billing_store_restore_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreRestoreRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreRestoreResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - HTTPBearer: []
components:
  schemas:
    AppStoreNotificationRequest:
      properties:
        signedPayload:
          type: string
          title: Signedpayload
      type: object
      required:
      - signedPayload
      title: AppStoreNotificationRequest
    BillingSyncRequest:
      properties:
        session_id:
          type: string
          title: Session Id
      type: object
      title: BillingSyncRequest
    BillingCatalogResponse:
      properties:
        plans:
          items:
            type: object
          type: array
          title: Plans
      type: object
      required:
      - plans
      title: BillingCatalogResponse
    CheckoutResponse:
      properties:
        checkout_url:
          type: string
          title: Checkout Url
      type: object
      required:
      - checkout_url
      title: CheckoutResponse
    RunLimit:
      properties:
        scope:
          type: string
          enum:
          - anonymous_lifetime
          - member_daily
          - unlimited
          title: Scope
        limit:
          type: integer
          title: Limit
        used:
          type: integer
          title: Used
        remaining:
          type: integer
          title: Remaining
        reset_at:
          type: string
          format: date-time
          title: Reset At
      type: object
      required:
      - scope
      title: RunLimit
      description: "Structured run-allowance summary returned for every user.\n\n``scope`` selects which allowance applies:\n- ``anonymous_lifetime``: anonymous lifetime sign-in run cap.\n- ``member_daily``: signed-in free member's daily compute allowance.\n- ``unlimited``: Pro/pass users have no compute cap (limit/used/remaining\n  and reset_at are all null).\n\n``reset_at`` is the exact instant the daily window rolls over (member_daily\nonly) so the frontend can render it in the user's local timezone."
    StoreSettledTransaction:
      properties:
        transaction_id:
          type: string
          title: Transaction Id
        purchase_token:
          type: string
          title: Purchase Token
      type: object
      title: StoreSettledTransaction
      description: 'Identifies a restored transaction the server actually verified and

        provisioned, so the client may settle (finish / acknowledge) it. Echoes the

        client-reported lookup keys back so the caller can match its own native

        purchase objects. Transactions the server skipped are absent — the client

        must leave those unsettled so the store re-delivers them later.'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StoreRestoreRequest:
      properties:
        platform:
          type: string
          enum:
          - ios
          - android
          title: Platform
        transactions:
          items:
            $ref: '#/components/schemas/StoreRestoreItem'
          type: array
          title: Transactions
          default: []
      type: object
      required:
      - platform
      title: StoreRestoreRequest
    AuthUser:
      properties:
        id:
          type: integer
          title: Id
        provider:
          type: string
          title: Provider
        name:
          type: string
          title: Name
        email:
          type: string
          title: Email
        picture:
          type: string
          title: Picture
      type: object
      required:
      - id
      - provider
      - name
      title: AuthUser
    PortalResponse:
      properties:
        portal_url:
          type: string
          title: Portal Url
      type: object
      required:
      - portal_url
      title: PortalResponse
    StoreVerifyRequest:
      properties:
        platform:
          type: string
          enum:
          - ios
          - android
          title: Platform
        product_id:
          type: string
          title: Product Id
        transaction_id:
          type: string
          title: Transaction Id
        signed_transaction:
          type: string
          title: Signed Transaction
        purchase_token:
          type: string
          title: Purchase Token
      type: object
      required:
      - platform
      - product_id
      title: StoreVerifyRequest
      description: 'Client-reported purchase to verify server-side. The client values are NOT

        trusted for the grant — they are only the lookup keys we re-verify against

        the store''s server API.'
    StoreRestoreResponse:
      properties:
        restored:
          type: integer
          title: Restored
        settled:
          items:
            $ref: '#/components/schemas/StoreSettledTransaction'
          type: array
          title: Settled
          default: []
        session:
          $ref: '#/components/schemas/AuthSessionResponse'
      type: object
      required:
      - restored
      - session
      title: StoreRestoreResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    StoreRestoreItem:
      properties:
        product_id:
          type: string
          title: Product Id
        transaction_id:
          type: string
          title: Transaction Id
        signed_transaction:
          type: string
          title: Signed Transaction
        purchase_token:
          type: string
          title: Purchase Token
      type: object
      title: StoreRestoreItem
    CheckoutRequest:
      properties:
        plan:
          type: string
          enum:
          - pass_30d
          - monthly
          - yearly
          title: Plan
          default: monthly
        return_path:
          type: string
          maxLength: 2048
          title: Return Path
      type: object
      title: CheckoutRequest
    AuthSessionResponse:
      properties:
        user:
          $ref: '#/components/schemas/AuthUser'
        anonymous:
          type: boolean
          title: Anonymous
          default: false
        account_tier:
          type: string
          title: Account Tier
          default: free
        scenario_cap:
          type: integer
          title: Scenario Cap
        run_cap:
          type: integer
          title: Run Cap
        runs_remaining:
          type: integer
          title: Runs Remaining
        run_limit:
          $ref: '#/components/schemas/RunLimit'
        billing_enabled:
          type: boolean
          title: Billing Enabled
          default: false
        has_stripe_customer:
          type: boolean
          title: Has Stripe Customer
          default: false
        paid_access_expires_at:
          type: string
          format: date-time
          title: Paid Access Expires At
        billing_plan:
          type: string
          title: Billing Plan
        has_active_subscription:
          type: boolean
          title: Has Active Subscription
          default: false
        can_start_stripe_checkout:
          type: boolean
          title: Can Start Stripe Checkout
          default: true
        can_start_store_purchase:
          type: boolean
          title: Can Start Store Purchase
          default: true
        trial_eligible:
          type: boolean
          title: Trial Eligible
          default: false
        pro_plan_price_usd:
          type: integer
          title: Pro Plan Price Usd
          default: 10
        free_n_scenarios:
          type: integer
          title: Free N Scenarios
        signup_conversion:
          type: boolean
          title: Signup Conversion
          default: false
        missing_terms_acceptance:
          type: boolean
          title: Missing Terms Acceptance
          default: false
        auth_token:
          type: string
          title: Auth Token
        auth_token_expires_at:
          type: string
          format: date-time
          title: Auth Token Expires At
      type: object
      required:
      - user
      title: AuthSessionResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer