RevenueCat Purchases API

v1 receipt validation and transaction lifecycle operations.

OpenAPI Specification

revenuecat-purchases-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: RevenueCat REST Apps Purchases API
  description: Representative OpenAPI description of RevenueCat's public REST surface. It covers the v1 REST API (https://api.revenuecat.com/v1) for subscribers, receipts/purchases, entitlements, offerings, and subscriber attributes, and the v2 REST API (https://api.revenuecat.com/v2) for projects, apps, customers, products, entitlements, offerings, and packages. Both APIs use HTTP Bearer authentication with a RevenueCat API key (v1 public or secret keys; v2 API keys). RevenueCat also delivers subscription lifecycle events via outbound webhooks (documented separately).
  termsOfService: https://www.revenuecat.com/terms/
  contact:
    name: RevenueCat Support
    url: https://www.revenuecat.com/docs
  version: '1.0'
servers:
- url: https://api.revenuecat.com/v1
  description: RevenueCat REST API v1
- url: https://api.revenuecat.com/v2
  description: RevenueCat REST API v2
tags:
- name: Purchases
  description: v1 receipt validation and transaction lifecycle operations.
paths:
  /receipts:
    post:
      operationId: createReceipt
      tags:
      - Purchases
      summary: Create a purchase (validate a receipt)
      description: Records a purchase by validating a store receipt or token from App Store, Google Play, Amazon, Stripe, Roku, or Paddle and attaches it to the given app user.
      servers:
      - url: https://api.revenuecat.com/v1
      parameters:
      - $ref: '#/components/parameters/PlatformHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReceiptRequest'
      responses:
        '200':
          description: The updated subscriber object after the receipt was processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriberResponse'
        '201':
          description: A new receipt was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriberResponse'
      security:
      - bearerAuth: []
  /subscribers/{app_user_id}/transactions/{store_transaction_identifier}/refund:
    post:
      operationId: refundTransaction
      tags:
      - Purchases
      summary: Refund a transaction
      description: Issues a refund for a Google Play transaction.
      servers:
      - url: https://api.revenuecat.com/v1
      parameters:
      - $ref: '#/components/parameters/AppUserId'
      - name: store_transaction_identifier
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: The transaction was refunded.
      security:
      - bearerAuth: []
  /subscribers/{app_user_id}/subscriptions/{product_identifier}/defer:
    post:
      operationId: deferSubscription
      tags:
      - Purchases
      summary: Defer a Google subscription
      description: Defers the next renewal date of an active Google Play subscription.
      servers:
      - url: https://api.revenuecat.com/v1
      parameters:
      - $ref: '#/components/parameters/AppUserId'
      - name: product_identifier
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                expiry_time_ms:
                  type: integer
                  format: int64
      responses:
        '200':
          description: The subscription renewal was deferred.
      security:
      - bearerAuth: []
components:
  parameters:
    PlatformHeader:
      name: X-Platform
      in: header
      required: false
      description: The platform the request originates from (ios, android, etc.).
      schema:
        type: string
    AppUserId:
      name: app_user_id
      in: path
      required: true
      description: The App User ID that identifies the customer.
      schema:
        type: string
  schemas:
    SubscriberResponse:
      type: object
      properties:
        request_date:
          type: string
          format: date-time
        request_date_ms:
          type: integer
          format: int64
        subscriber:
          $ref: '#/components/schemas/Subscriber'
    EntitlementInfo:
      type: object
      properties:
        expires_date:
          type: string
          format: date-time
          nullable: true
        purchase_date:
          type: string
          format: date-time
        product_identifier:
          type: string
    Subscriber:
      type: object
      properties:
        original_app_user_id:
          type: string
        first_seen:
          type: string
          format: date-time
        last_seen:
          type: string
          format: date-time
        management_url:
          type: string
          nullable: true
        entitlements:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/EntitlementInfo'
        subscriptions:
          type: object
          additionalProperties:
            type: object
        non_subscriptions:
          type: object
          additionalProperties:
            type: array
            items:
              type: object
        subscriber_attributes:
          type: object
          additionalProperties:
            type: object
    ReceiptRequest:
      type: object
      required:
      - app_user_id
      - fetch_token
      properties:
        app_user_id:
          type: string
        fetch_token:
          type: string
          description: The store receipt or purchase token to validate.
        product_id:
          type: string
        price:
          type: number
        currency:
          type: string
        is_restore:
          type: boolean
        presented_offering_identifier:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: RevenueCat API key passed as an HTTP Bearer token. v1 accepts public (client) or secret (server) keys; v2 uses dedicated v2 API keys.