---
title: "Handle Purchase"
method: POST
path: "/api/v1/purchase"
tags: ["Purchase"]
---

# Handle Purchase

`POST /api/v1/purchase`

## Request

- Base URL: `https://foto.damdafa.com/dreamhome`
- URL: `https://foto.damdafa.com/dreamhome/api/v1/purchase`
- Auth: HTTP bearer

Process an in-app purchase from Google Play Store or Apple App Store.

Validates the purchase token/receipt and processes the purchase for the authenticated user.

Args:
    request: Purchase request with OS, product ID, and token/receipt
    auth: Authenticated user context
    service: App-specific purchase service (injected)

Returns:
    PurchaseResponse with success status and subscription details

## Headers

- `ProviderId` 'firebase' | 'google' | 'apple'
- `X-Provider-Id` 'firebase' | 'google' | 'apple'
- `X-Device-Id` string, nullable

## Request body

- PurchaseRequest: Request schema for processing a purchase.
  - `os` string, required: Operating system: 'ios' or 'android'
  - `productId` string, required: Product/subscription ID
  - `purchaseToken` string, nullable: Google Play purchase token
  - `transactionId` string, nullable: Transaction ID
  - `originalTransactionId` string, nullable: Original transaction ID
  - `promoCode` string, nullable: Optional promo code for bonuses

## Response `200`

Successful Response

- PurchaseResponse: Response schema for purchase processing.
  - `success` boolean, required
  - `message` string, required
  - `subscription_active` boolean, nullable
  - `expiry_date` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/damdafa/apis/homedecor-api.md) · [All operations](https://skmtc.dev/damdafa/apis/homedecor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/damdafa/apis/homedecor-api/revisions/372f33a6d18e?raw)
