Skip to content

Subscriptions

Verify Purchase

Endpoint: POST /subscriptions/verify

Description: Verify a subscription purchase from the mobile app (Google Play or Apple App Store).

Request Body:

{
    "platform": "google",
    "product_id": "premium_monthly",
    "purchase_token": "google_play_purchase_token"
}

Response: 200 OK

{
    "status": "success",
    "message": "Purchase verified successfully",
    "data": {
        "subscription": {
            "id": "subscription_uuid",
            "user_id": "user_uuid",
            "status": "active",
            "platform": "google",
            "product_id": "premium_monthly",
            "started_at": "2025-11-27T10:00:00Z",
            "expires_at": "2025-12-27T10:00:00Z",
            "cancelled_at": null,
            "auto_renewing": true,
            "original_transaction_id": "original_transaction_id",
            "latest_transaction_id": "latest_transaction_id"
        }
    }
}

Get Subscription Status

Endpoint: GET /subscriptions/status

Description: Check if a user has an active subscription.

Response: 200 OK

{
    "status": "success",
    "message": "Active subscription found",
    "data": {
        "has_active_subscription": true,
        "subscription": {
            "id": "subscription_uuid",
            "user_id": "user_uuid",
            "status": "active",
            "platform": "google",
            "product_id": "premium_monthly",
            "started_at": "2025-11-27T10:00:00Z",
            "expires_at": "2025-12-27T10:00:00Z",
            "cancelled_at": null,
            "auto_renewing": true,
            "original_transaction_id": "original_transaction_id",
            "latest_transaction_id": "latest_transaction_id"
        },
        "days_remaining": 30
    }
}

Check Premium Access

Endpoint: GET /subscriptions/access

Description: Simple endpoint to check if a user has premium access.

Response: 200 OK

{
    "status": "success",
    "message": "Premium access checked",
    "data": {
        "user_id": "user_uuid",
        "has_premium_access": true
    }
}

Get Subscription

Endpoint: GET /subscriptions/{subscription_id}

Description: Get detailed information about a specific subscription.

Response: 200 OK

{
    "status": "success",
    "message": "Subscription retrieved",
    "data": {
        "subscription": {
            "id": "subscription_uuid",
            "user_id": "user_uuid",
            "status": "active",
            "platform": "google",
            "product_id": "premium_monthly",
            "started_at": "2025-11-27T10:00:00Z",
            "expires_at": "2025-12-27T10:00:00Z",
            "cancelled_at": null,
            "auto_renewing": true,
            "original_transaction_id": "original_transaction_id",
            "latest_transaction_id": "latest_transaction_id",
            "created_at": "2025-11-27T10:00:00Z",
            "updated_at": "2025-11-27T10:00:00Z"
        }
    }
}