0% found this document useful (0 votes)
11 views6 pages

Subscription Service API Documentation

The document provides API documentation for the Client Subscription Service, detailing endpoints for fetching subscription plans, client profiles with subscriptions, and updating client profiles and subscriptions. It includes request/response structures, error handling, and sample responses for each API. Key functionalities include retrieving active subscription plans and managing client subscription details based on their email addresses.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Subscription Service API Documentation

The document provides API documentation for the Client Subscription Service, detailing endpoints for fetching subscription plans, client profiles with subscriptions, and updating client profiles and subscriptions. It includes request/response structures, error handling, and sample responses for each API. Key functionalities include retrieving active subscription plans and managing client subscription details based on their email addresses.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

API Documentation:

Client-Subscription-Service

This document describes the Subscription Service APIs, their purpose, request/response
structures, and standard error handling. All APIs return a common response wrapper.

Quick Links:

Bit Bucket: client-subscription-service-bitbucket

Swagger URL: client-subscription-service-swagger

Postman API collection link: client-subscription-service-API


1. Fetch Subscription Plans
Description: Fetches all active subscription plans available for clients.

HTTP Method and URL:

GET /api/subscription/plans

[Link]

Request Header- x-correlation-id: cprr-123

Sample Response:
{
"correlationId": “corr-123”,
"status": "SUCCESS",
"message": "Fetched all plans successfully",
"data": [
{
"subscriptionId": 5,
"planName": "Monthly",
"planDescription": "Pay monthly, cancel anytime",
"planPrice": "100.00",
"planPeriodInMonth": 1,
"isActive": true,
"isDefault": true,
"displayOrder": 5,
"currency": "USD",
"planPriceText": "$100.00 / Month"
},
{
"subscriptionId": 6,
"planName": "Yearly",
"planDescription": "Save 10% with annual billing",
"planPrice": "1080.00",
"planPeriodInMonth": 12,
"isActive": true,
"isDefault": false,
"displayOrder": 6,
"currency": "USD",
"planPriceText": "$1080.00 / Year"
},
{
"subscriptionId": 7,
"planName": "Enterprise",
"planDescription": "Custom solutions for your needs",
"planPrice": "Custom",
"planPeriodInMonth": null,
"isActive": true,
"isDefault": false,
"displayOrder": 7,
"currency": "USD",
"planPriceText": "Custom"
}
],
"error": null
}

Success Response
Status: 200 OK
Returns a list of subscription plans including pricing, duration, and display order.

Error Codes
SUBSCRIPTION_PLAN_FETCH_FAILED – Unable to fetch subscription plans
INTERNAL_ERROR – Unexpected system error

2. Fetch Client with Subscription


Description: Fetches client profile details along with active subscription information.

GET /api/client/{email}

[Link]
alokkumar@[Link]

{
"correlationId": “corr-123”,
"status": "SUCCESS",
"message": "Client fetched successfully",
"data": {
"clientId": 245,
"email": "alokkumar@[Link]",
"firstName": "Alok",
"lastName": "Kumar",
"zipcode": "230068",
"subscription": {
"subscriptionId": 6,
"planName": "Yearly",
"planDescription": "Save 10% with annual billing",
"planPriceText": "$1080.00 / Year"
}
},
"error": null
}

Success Response
Status: 200 OK
Returns client profile and subscription details if available.

Error Codes
CLIENT_NOT_FOUND – Client does not exist for given email
CLIENT_SERVICE_ERROR – Client service processing failed
INTERNAL_ERROR – Unexpected system error

3. Update Client Profile and Subscription


Description: Updates optional client profile fields and creates or updates the client
subscription. If subscriptionId is 0, default active plan is applied.

POST /api/client/updateWithSubscription/{email}

[Link]
updateWithSubscription/alokkumar@[Link]

Request Body
{

"correlationId": "abcd123",
"subscriptionId": 5,
"firstName": "Alok",
"lastName": "Kumar",
"zipcode": "240068"
}

Success Response

{
"correlationId": "abcd123",
"status": "SUCCESS",
"message": "Client profile updated and subscription saved successfully",
"data": {
"email": "alokkumar@[Link]",
"subscriptionId": 5
},
"error": null
}
Status: 200 OK
Client profile updated and subscription saved successfully.

Error Codes
CLIENT_NOT_FOUND – Client profile does not exist
INVALID_SUBSCRIPTION – Invalid subscription plan selected
CLIENT_SERVICE_ERROR – Failed to update client profile or subscription
INTERNAL_ERROR – Unexpected system error

Standard Error Codes Summary


SQL_ERROR – Database-related failure
VALIDATION_ERROR – Invalid request payload
CLIENT_SERVICE_ERROR – Business logic failure
INTERNAL_ERROR – Unexpected runtime error

You might also like