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

# Validate a mobile in-app purchase receipt (Apple/Google)

> Validates a JWS transaction returned by StoreKit (iOS) or Google Play Billing and creates/updates the corresponding subscription. iOS-only in this version — Android continues to use Stripe via the web checkout.



## OpenAPI

````yaml https://portal.unicontrol.me/v1/openapi post /v1/billing/mobile-receipt/validate
openapi: 3.1.0
info:
  title: Unicontrol API
  description: Welcome
  version: 1.0.0
servers:
  - url: http://0.0.0.0:3000
    description: Local Server
  - url: https://portal.test.flexhome.casa
    description: Development
  - url: https://portal.unicontrol.me
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/billing/mobile-receipt/validate:
    post:
      tags:
        - Billing
      summary: Validate a mobile in-app purchase receipt (Apple/Google)
      description: >-
        Validates a JWS transaction returned by StoreKit (iOS) or Google Play
        Billing and creates/updates the corresponding subscription. iOS-only in
        this version — Android continues to use Stripe via the web checkout.
      operationId: postV1BillingMobile-receiptValidate
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                platform:
                  type: string
                  enum:
                    - apple
                  description: Mobile gateway provider
                planId:
                  type: number
                  description: Internal plan ID
                receiptData:
                  type: string
                  description: JWS signedTransaction returned by StoreKit 2
              required:
                - platform
                - planId
                - receiptData
            example:
              platform: apple
              planId: 2
              receiptData: eyJhbGciOiJFUzI1NiIs...
        required: true
      responses:
        '200':
          description: Subscription created or updated
          content:
            application/json:
              example:
                status: true
                data:
                  id: 12
                  plan_id: 2
                  gateway_provider: apple
                  status: active
        '400':
          description: Dados inválidos
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: validation error
        '401':
          description: Não autenticado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: unauthorized
        '404':
          description: Recurso não encontrado
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: not found
        '409':
          description: Receipt already linked to another user
          content:
            application/json:
              example:
                status: false
                message: Receipt already linked to another user
        '500':
          description: Erro interno do servidor
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: internal_error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````