Skip to content

SubscriptionsController API Documentation

Lee Sambridge edited this page Mar 21, 2025 · 9 revisions

Subscriptions API Documentation

This document provides documentation for the Subscriptions API endpoints available in the Points.Api system.

Table of Contents

Authentication

All endpoints in the Subscriptions API require JWT Bearer authentication. Include the JWT token in the Authorization header of your requests:

Authorization: Bearer {your_jwt_token}

Endpoints

Create Subscription

Creates a new subscription for the authenticated partner.

URL: /api/Subscriptions

Method: POST

Auth required: Yes (JWT Bearer token)

Request Body:

{
  "name": "Premium Subscription",
  "description": "Premium subscription with additional features",
  "price": 19.99,
  "currency": "USD",
  "billingFrequency": "monthly",
  "features": ["Feature 1", "Feature 2", "Feature 3"]
}

Success Response:

  • Code: 200 OK
  • Content: Created subscription details

Error Response:

  • Code: 404 Not Found
  • Content: "Partner does not exist"

Example Request:

POST /api/Subscriptions HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json

{
  "name": "Premium Subscription",
  "description": "Premium subscription with additional features",
  "price": 19.99,
  "currency": "USD",
  "billingFrequency": "monthly",
  "features": ["Feature 1", "Feature 2", "Feature 3"]
}

Example Response:

{
  "id": 123,
  "name": "Premium Subscription",
  "description": "Premium subscription with additional features",
  "price": 19.99,
  "currency": "USD",
  "billingFrequency": "monthly",
  "features": ["Feature 1", "Feature 2", "Feature 3"],
  "partnerId": 456,
  "createdDate": "2025-03-21T10:51:34Z"
}

Notes:

  • The partner ID is extracted from the JWT token claims.
  • If the partner ID is not found in the claims, a 404 error is returned.

Delete Subscription

Deletes a subscription.

URL: /api/Subscriptions/{subscriptionId}

Method: DELETE

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • subscriptionId (long) - ID of the subscription to delete

Success Response:

  • Code: 200 OK
  • Content: Result of the delete operation

Example Request:

DELETE /api/Subscriptions/123 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

{
  "success": true,
  "message": "Subscription deleted successfully"
}

Get Subscriptions

Retrieves all subscriptions for the authenticated partner.

URL: /api/Subscriptions

Method: GET

Auth required: Yes (JWT Bearer token)

Success Response:

  • Code: 200 OK
  • Content: List of subscriptions for the partner

Error Response:

  • Code: 404 Not Found
  • Content: "Partner does not exist"

Example Request:

GET /api/Subscriptions HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

[
  {
    "id": 123,
    "name": "Premium Subscription",
    "description": "Premium subscription with additional features",
    "price": 19.99,
    "currency": "USD",
    "billingFrequency": "monthly",
    "features": ["Feature 1", "Feature 2", "Feature 3"],
    "partnerId": 456,
    "createdDate": "2025-03-21T10:51:34Z"
  },
  {
    "id": 124,
    "name": "Basic Subscription",
    "description": "Basic subscription with core features",
    "price": 9.99,
    "currency": "USD",
    "billingFrequency": "monthly",
    "features": ["Feature 1"],
    "partnerId": 456,
    "createdDate": "2025-03-20T15:30:00Z"
  }
]

Notes:

  • The partner ID is extracted from the JWT token claims.
  • If the partner ID is not found in the claims, a 404 error is returned.

Clone this wiki locally