Indexhog - Search indexing and monitoring

Payments API

Inspection credits and Business access via Stripe

1 min read

Stripe billing for inspection-credit packs and optional Business workspace access. Purchase credits, manage Business access, open the billing portal, and retrieve balances and billing history.

Available Endpoints

MethodEndpointDescription
POST/api/user/organizations/{organizationId}/payments/checkoutCreate a credit-pack or Business checkout
GET/api/user/organizations/{organizationId}/payments/purchasesGet organization purchase history
GET/api/user/organizations/{organizationId}/payments/creditsGet available inspection credits and expiring lots
POST/api/user/organizations/{organizationId}/payments/verifyVerify checkout completion
GET/api/user/organizations/{organizationId}/payments/subscriptionGet the Business subscription
PATCH/api/user/organizations/{organizationId}/payments/subscriptionUpdate Business member capacity or interval
GET/api/user/organizations/{organizationId}/payments/subscription/usageGet active member usage
GET/api/user/organizations/{organizationId}/payments/portalCreate a Stripe Billing Portal session

Endpoints

POST/api/user/organizations/{organizationId}/payments/checkout

Create a credit-pack or Business checkout

Bearer Token•Scopes: subscription:write, organization:manage-billing

Request

curl -X POST "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/checkout" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"kind":"credits","operationId":"string","packs":1,"successUrl":"https://indexhog.com/billing/success","cancelUrl":"https://indexhog.com/billing/cancel"}'

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Response 200

Checkout session created

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "sessionId": "string",
  "url": "https://example.com"
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
GET/api/user/organizations/{organizationId}/payments/purchases

Get organization purchase history

Bearer Token•Scopes: subscription:read, organization:read

Request

curl -X GET "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/purchases" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json"

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Query Parameters

NameTypeDescription
offsetnumber | nullNumber of items to skip
0
limitnumberNumber of items to return (max 100)
20

Response 200

Purchase history fetched

{
"success": true,
"status": 200,
"code": "OK",
"message": "Items fetched successfully",
"data": [
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "purchasedByUserId": "550e8400-e29b-41d4-a716-446655440000",
    "provider": "stripe",
    "items": [
      {
        "productId": "retired_product_id",
        "quantity": 1,
        "grants": [
          {
            "type": "seats",
            "amount": 1
          }
        ],
        "kind": "business",
        "billing": "recurring"
      }
    ],
    "acquiredAt": "2024-01-15T10:30:00.000Z",
    "availableAt": "2024-01-15T10:30:00.000Z",
    "kind": "subscription",
    "subscriptionInterval": "monthly",
    "expiresAt": "2024-01-15T10:30:00.000Z",
    "status": "paid",
    "reversedAt": null,
    "reversalReason": null,
    "restoredAt": null
  }
],
"meta": {
  "total": 100,
  "offset": 0,
  "limit": 10,
  "hasMore": true
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
GET/api/user/organizations/{organizationId}/payments/credits

Get available inspection credits and expiring lots

Bearer Token•Scopes: subscription:read, organization:read

Request

curl -X GET "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/credits" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json"

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Response 200

Credit balance retrieved

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "balance": 0,
  "lots": [
    {
      "grantId": "string",
      "source": "credit_pack_purchase",
      "remaining": 0,
      "expiresAt": "2024-01-15T10:30:00.000Z"
    }
  ]
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
POST/api/user/organizations/{organizationId}/payments/verify

Verify checkout completion

Bearer Token•Scopes: subscription:write

Request

curl -X POST "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/verify" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"sessionId":"string"}'

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Body Parameters

NameTypeDescription
sessionIdrequiredstring

Response 200

Checkout verification result

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "status": "complete",
  "customerId": "string"
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
GET/api/user/organizations/{organizationId}/payments/subscription

Get the Business subscription

Bearer Token•Scopes: subscription:read, organization:read

Request

curl -X GET "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/subscription" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json"

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Response 200

Business subscription retrieved

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "status": "active",
  "interval": "monthly",
  "currentPeriodEnd": "2024-01-15T10:30:00.000Z",
  "cancelAt": "2024-01-15T10:30:00.000Z",
  "memberCap": 1
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
PATCH/api/user/organizations/{organizationId}/payments/subscription

Update Business member capacity or interval

Bearer Token•Scopes: subscription:write, organization:manage-billing

Request

curl -X PATCH "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/subscription" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"operationId":"string","memberCap":1,"interval":"monthly"}'

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Body Parameters

NameTypeDescription
operationIdrequiredstring
memberCapnumber
intervalBillingInterval

Response 200

Business subscription updated

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "status": "active",
  "interval": "monthly",
  "currentPeriodEnd": "2024-01-15T10:30:00.000Z",
  "cancelAt": "2024-01-15T10:30:00.000Z",
  "memberCap": 1
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
GET/api/user/organizations/{organizationId}/payments/subscription/usage

Get active member usage

Bearer Token•Scopes: subscription:read, organization:read

Request

curl -X GET "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/subscription/usage" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json"

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Response 200

Member usage retrieved

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "activeMembers": 0,
  "projectCount": 0
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}
GET/api/user/organizations/{organizationId}/payments/portal

Create a Stripe Billing Portal session

Bearer Token•Scopes: subscription:write, organization:manage-billing

Request

curl -X GET "https://api.indexhog.com/api/user/organizations/{organizationId}/payments/portal" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json"

Path Parameters

NameTypeDescription
organizationIdrequiredstringOrganization ID
550e8400-e29b-41d4-a716-446655440000

Query Parameters

NameTypeDescription
returnUrlrequiredstring

Response 200

Portal session created

{
"success": true,
"status": 200,
"code": "OK",
"message": "Operation completed successfully",
"data": {
  "url": "https://example.com"
}
}

Error Responses

401— Unauthorized - Invalid or missing authentication

{
"success": false,
"status": 401,
"code": "UNAUTHORIZED",
"message": "Authentication required"
}

403— Forbidden - Insufficient permissions

{
"success": false,
"status": 403,
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action"
}