

# **AIFITAPP**

**FRONTEND GUIDE FOR AI CODING AGENTS - PART 9 - Subscription Service**

This document is a part of a REST API guide for the aifitapp project.
It is designed for AI agents that will generate frontend code to consume the project’s backend.

This document provides extensive instruction for the usage of subscription

## Service Access

Subscription service management is handled through service specific base urls.

Subscription  service may be deployed to the preview server, staging server, or production server. Therefore,it has 3 access URLs.
The frontend application must support all deployment environments during development, and the user should be able to select the target API server on the login page (already handled in first part.).

For the subscription service, the base URLs are:

* **Preview:** `https://appaili.prw.mindbricks.com/subscription-api`
* **Staging:** `https://appaili-stage.mindbricks.co/subscription-api`
* **Production:** `https://appaili.mindbricks.co/subscription-api`


## Scope

**Subscription Service Description**

Manages the single premium subscription plan lifecycle including activation, status tracking, cancellation, and admin-configurable pricing. Provides subscription status validation endpoints for other services to gate access to AI-powered featuresa.z

Subscription service provides apis and business logic for following data objects in aifitapp application. 
Each data object may be either a central domain of the application data structure or a related helper data object for a central concept.
Note that data object concept is equal to table concept in the database, in the service database each data object is represented as a db table scheme and the object instances as table rows.  


**`pricingConfig` Data Object**: Stores the current premium subscription pricing configuration. Admin-managed, single system-wide record.

**`subscription` Data Object**: Represents a user&#39;s premium subscription record, serving as the Stripe payment object. Tracks payment status, price paid, and subscription lifecycle dates.

**`sys_subscriptionPayment` Data Object**: A payment storage object to store the payment life cyle of orders based on subscription object. It is autocreated based on the source object&#39;s checkout config

**`sys_paymentCustomer` Data Object**: A payment storage object to store the customer values of the payment platform

**`sys_paymentMethod` Data Object**: A payment storage object to store the payment methods of the platform customers


## Subscription Service Frontend Description By The Backend Architect

# Subscription Service UX Guide

This service manages premium subscriptions. Key UX behaviors:

- Users must subscribe to the premium plan before accessing any AI features (training programs, nutrition plans, chatbot).
- The subscription pricing is displayed from the pricingConfig endpoint. Show the current price and description to users before they initiate payment.
- After successful Stripe payment, the subscription becomes active immediately. Redirect users to the main app experience.
- Users can view their subscription status at any time via getMySubscription.
- Users can cancel their subscription. After cancellation, inform them that AI features will no longer be accessible.
- Admin users manage pricing through API calls. Price changes affect new subscriptions only, not existing ones.

## API Structure

### Object Structure of a Successful Response

When the service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope includes the data and essential metadata such as configuration details and pagination information, providing context to the client.

**HTTP Status Codes:**

* **200 OK**: Returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request was processed successfully.
* **201 Created**: Returned for CREATE operations, indicating that the resource was created successfully.

**Success Response Format:**

For successful operations, the response includes a `"status": "OK"` property, signaling that the request executed successfully. The structure of a successful response is outlined below:

```json
{
  "status":"OK",
  "statusCode": 200,   
  "elapsedMs":126,
  "ssoTime":120,
  "source": "db",
  "cacheKey": "hexCode",
  "userId": "ID",
  "sessionId": "ID",
  "requestId": "ID",
  "dataName":"products",
  "method":"GET",
  "action":"list",
  "appVersion":"Version",
  "rowCount":3,
  "products":[{},{},{}],
  "paging": {
    "pageNumber":1, 
    "pageRowCount":25, 
    "totalRowCount":3,
    "pageCount":1
  },
  "filters": [],
  "uiPermissions": []
}
```
* **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation.

### Additional Data

Each API may include additional data besides the main data object, depending on the business logic of the API. These will be provided in each API’s response signature.

### Error Response

If a request encounters an issue—whether due to a logical fault or a technical problem—the service responds with a standardized JSON error structure. The HTTP status code indicates the nature of the error, using commonly recognized codes for clarity:

* **400 Bad Request**: The request was improperly formatted or contained invalid parameters.
* **401 Unauthorized**: The request lacked a valid authentication token; login is required.
* **403 Forbidden**: The current token does not grant access to the requested resource.
* **404 Not Found**: The requested resource was not found on the server.
* **500 Internal Server Error**: The server encountered an unexpected condition.

Each error response is structured to provide meaningful insight into the problem, assisting in efficient diagnosis and resolution.

```js
{
  "result": "ERR",
  "status": 400,
  "message": "errMsg_organizationIdisNotAValidID",
  "errCode": 400,
  "date": "2024-03-19T12:13:54.124Z",
  "detail": "String"
}
```


## PricingConfig Data Object

Stores the current premium subscription pricing configuration. Admin-managed, single system-wide record.



### PricingConfig Data Object Properties

PricingConfig data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `currency` | String | false | Yes | No | Currency code for pricing (e.g., usd). |
| `description` | Text | false | No | No | Human-readable description of the subscription plan. |
| `price` | Integer | false | Yes | No | Current subscription price in cents (e.g., 999 = $9.99). |
| `type` | Enum | false | Yes | No |  |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.



### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values.
In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.

- **type**: [subscription, quota]




## Subscription Data Object

Represents a user&#39;s premium subscription record, serving as the Stripe payment object. Tracks payment status, price paid, and subscription lifecycle dates.



### Subscription Data Object Properties

Subscription data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `activatedAt` | Date | false | No | No | Timestamp when the subscription was activated after successful payment. |
| `cancelledAt` | Date | false | No | No | Timestamp when the subscription was cancelled by the user. |
| `currency` | String | false | Yes | No | Currency code for the payment (e.g., usd). |
| `pricePaid` | Integer | false | Yes | No | Amount paid in cents at the time of subscription activation. |
| `status` | Enum | false | No | No | Current subscription status managed by Stripe payment flow. |
| `statusUpdatedAt` | Date | false | No | No | Timestamp of the last status update, auto-managed by Stripe payment flow. |
| `userId` | ID | false | Yes | No | Reference to the user who owns this subscription. |
| `paymentConfirmation` | Enum | false | Yes | No | An automatic property that is used to check the confirmed status of the payment set by webhooks. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.



### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values.
In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.

- **status**: [pending, active, cancelled, expired, failed]

- **paymentConfirmation**: [pending, processing, paid, canceled]


### Relation Properties

`userId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search.
These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects.
If the relation points to another service, frontend should use the referenced service api in case it needs related data.
The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. 
In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that, 

1- instaead of these relational ids you show the main human readable field of the related target data (like name),
2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.


- **userId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes


### Filter Properties

`status` `userId` `paymentConfirmation`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **status**: Enum  has a filter named `status`

- **userId**: ID  has a filter named `userId`

- **paymentConfirmation**: Enum  has a filter named `paymentConfirmation`


## Sys_subscriptionPayment Data Object

A payment storage object to store the payment life cyle of orders based on subscription object. It is autocreated based on the source object&#39;s checkout config



### Sys_subscriptionPayment Data Object Properties

Sys_subscriptionPayment data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `ownerId` | ID | false | No | No |  An ID value to represent owner user who created the order |
| `orderId` | ID | false | Yes | No | an ID value to represent the orderId which is the ID parameter of the source subscription object |
| `paymentId` | String | false | Yes | No | A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type |
| `paymentStatus` | String | false | Yes | No | A string value to represent the payment status which belongs to the lifecyle of a Stripe payment. |
| `statusLiteral` | String | false | Yes | No | A string value to represent the logical payment status which belongs to the application lifecycle itself. |
| `redirectUrl` | String | false | No | No | A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.





### Filter Properties

`ownerId` `orderId` `paymentId` `paymentStatus` `statusLiteral` `redirectUrl`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **ownerId**: ID  has a filter named `ownerId`

- **orderId**: ID  has a filter named `orderId`

- **paymentId**: String  has a filter named `paymentId`

- **paymentStatus**: String  has a filter named `paymentStatus`

- **statusLiteral**: String  has a filter named `statusLiteral`

- **redirectUrl**: String  has a filter named `redirectUrl`


## Sys_paymentCustomer Data Object

A payment storage object to store the customer values of the payment platform



### Sys_paymentCustomer Data Object Properties

Sys_paymentCustomer data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `userId` | ID | false | No | No |  An ID value to represent the user who is created as a stripe customer |
| `customerId` | String | false | Yes | No | A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway |
| `platform` | String | false | Yes | No | A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.





### Filter Properties

`userId` `customerId` `platform`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **userId**: ID  has a filter named `userId`

- **customerId**: String  has a filter named `customerId`

- **platform**: String  has a filter named `platform`


## Sys_paymentMethod Data Object

A payment storage object to store the payment methods of the platform customers



### Sys_paymentMethod Data Object Properties

Sys_paymentMethod data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `paymentMethodId` | String | false | Yes | No | A string value to represent the id of the payment method on the payment platform. |
| `userId` | ID | false | Yes | No |  An ID value to represent the user who owns the payment method |
| `customerId` | String | false | Yes | No | A string value to represent the customer id which is generated on the payment gateway. |
| `cardHolderName` | String | false | No | No | A string value to represent the name of the card holder. It can be different than the registered customer. |
| `cardHolderZip` | String | false | No | No | A string value to represent the zip code of the card holder. It is used for address verification in specific countries. |
| `platform` | String | false | Yes | No | A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future. |
| `cardInfo` | Object | false | Yes | No | A Json value to store the card details of the payment method. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.





### Filter Properties

`paymentMethodId` `userId` `customerId` `cardHolderName` `cardHolderZip` `platform` `cardInfo`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **paymentMethodId**: String  has a filter named `paymentMethodId`

- **userId**: ID  has a filter named `userId`

- **customerId**: String  has a filter named `customerId`

- **cardHolderName**: String  has a filter named `cardHolderName`

- **cardHolderZip**: String  has a filter named `cardHolderZip`

- **platform**: String  has a filter named `platform`

- **cardInfo**: Object  has a filter named `cardInfo`



## Default CRUD APIs

For each data object, the backend architect may designate **default APIs** for standard operations (create, update, delete, get, list). These are the APIs that frontend CRUD forms and AI agents should use for basic record management. If no default is explicitly set (`isDefaultApi`), the frontend generator auto-discovers the most general API for each operation.

### PricingConfig Default APIs

**Display Label Property:** `description` — Use this property as the human-readable label when displaying records of this data object (e.g., in dropdowns, references).
| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createPricingConfig` | `/v1/pricingconfigs` | Yes |
| Update | `updatePricingConfig` | `/v1/pricingconfigs/:pricingConfigId` | Yes |
| Delete | `deletePricingConfig` | `/v1/pricingconfigs/:pricingConfigId` | Yes |
| Get | `getPricingConfig` | `/v1/pricingconfigs/:pricingConfigId` | Yes |
| List | `listPricingConfigs` | `/v1/pricingconfigs` | Yes |
### Subscription Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createSubscription` | `/v1/subscriptions` | Auto |
| Update | `cancelSubscription` | `/v1/subscriptions/:subscriptionId/cancel` | Auto |
| Delete | _none_ | - | Auto |
| Get | `getSubscription` | `/v1/subscriptions/:subscriptionId` | Yes |
| List | `listSubscriptions` | `/v1/subscriptions` | Yes |
### Sys_subscriptionPayment Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createSubscriptionPayment` | `/v1/subscriptionpayment` | Auto |
| Update | `updateSubscriptionPayment` | `/v1/subscriptionpayment/:sys_subscriptionPaymentId` | Auto |
| Delete | `deleteSubscriptionPayment` | `/v1/subscriptionpayment/:sys_subscriptionPaymentId` | Auto |
| Get | `getSubscriptionPayment` | `/v1/subscriptionpayment/:sys_subscriptionPaymentId` | Auto |
| List | `listSubscriptionPayments` | `/v1/subscriptionpayments` | Auto |
### Sys_paymentCustomer Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | _none_ | - | Auto |
| Update | _none_ | - | Auto |
| Delete | _none_ | - | Auto |
| Get | `getPaymentCustomerByUserId` | `/v1/paymentcustomers/:userId` | Auto |
| List | `listPaymentCustomers` | `/v1/paymentcustomers` | Auto |
### Sys_paymentMethod Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | _none_ | - | Auto |
| Update | _none_ | - | Auto |
| Delete | _none_ | - | Auto |
| Get | _none_ | - | Auto |
| List | `listPaymentCustomerMethods` | `/v1/paymentcustomermethods/:userId` | Auto |

When building CRUD forms for a data object, use the default create/update APIs listed above. The form fields should correspond to the API's body parameters. For relation fields, render a dropdown loaded from the related object's list API using the display label property.





## API Reference

### `Cancel Subscription` API
Cancel the authenticated user's active subscription. Sets the subscription status to cancelled and records the cancellation timestamp.

**API Frontend Description By The Backend Architect**

Call this endpoint when the user confirms they want to cancel their subscription. After successful cancellation, inform the user that they will lose access to AI features. The response contains the updated subscription record with status 'cancelled'.

**Rest Route**

The `cancelSubscription` API REST controller can be triggered via the following route:

`/v1/subscriptions/:subscriptionId/cancel`


**Rest Request Parameters**


The `cancelSubscription` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId  | ID  | true | request.params?.["subscriptionId"] |
**subscriptionId** : This id paremeter is used to select the required data object that will be updated



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/subscriptions/:subscriptionId/cancel**
```js
  axios({
    method: 'POST',
    url: `/v1/subscriptions/${subscriptionId}/cancel`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "POST",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Check Subscriptionstatus` API
Machine-to-machine endpoint for other services to validate if a user has an active subscription. Returns the active subscription record if one exists, or an empty list if not.


**Rest Route**

The `checkSubscriptionStatus` API REST controller can be triggered via the following route:

`/v1/check-status`


**Rest Request Parameters**


The `checkSubscriptionStatus` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId  | ID  | true | request.body?.["userId"] |
**userId** : The user ID to check subscription status for.



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/check-status**
```js
  axios({
    method: 'POST',
    url: '/v1/check-status',
    data: {
            userId:"ID",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**

This route's response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.

```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscriptions",
	"method": "POST",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"subscriptions": [
		{
			"isActive": true
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Create Pricingconfig` API
**[Default create API]** — This is the designated default `create` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Create a new pricing configuration record. Admin-only operation for setting up subscription pricing.


**Rest Route**

The `createPricingConfig` API REST controller can be triggered via the following route:

`/v1/pricingconfigs`


**Rest Request Parameters**


The `createPricingConfig` api has got 4 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| currency  | String  | true | request.body?.["currency"] |
| description  | Text  | false | request.body?.["description"] |
| price  | Integer  | true | request.body?.["price"] |
| type  | Enum  | true | request.body?.["type"] |
**currency** : Currency code for pricing (e.g., usd).
**description** : Human-readable description of the subscription plan.
**price** : Current subscription price in cents (e.g., 999 = $9.99).
**type** : 



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/pricingconfigs**
```js
  axios({
    method: 'POST',
    url: '/v1/pricingconfigs',
    data: {
            currency:"String",  
            description:"Text",  
            price:"Integer",  
            type:"Enum",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "pricingConfig",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"pricingConfig": {
		"id": "ID",
		"currency": "String",
		"description": "Text",
		"price": "Integer",
		"type": "Enum",
		"type_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Delete Pricingconfig` API
**[Default delete API]** — This is the designated default `delete` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Delete a pricing configuration record. Admin-only operation.


**Rest Route**

The `deletePricingConfig` API REST controller can be triggered via the following route:

`/v1/pricingconfigs/:pricingConfigId`


**Rest Request Parameters**


The `deletePricingConfig` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| pricingConfigId  | ID  | true | request.params?.["pricingConfigId"] |
**pricingConfigId** : This id paremeter is used to select the required data object that will be deleted



**REST Request**
To access the api you can use the **REST** controller with the path **DELETE  /v1/pricingconfigs/:pricingConfigId**
```js
  axios({
    method: 'DELETE',
    url: `/v1/pricingconfigs/${pricingConfigId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "pricingConfig",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"pricingConfig": {
		"id": "ID",
		"currency": "String",
		"description": "Text",
		"price": "Integer",
		"type": "Enum",
		"type_idx": "Integer",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Mysubscription` API
Retrieve the currently authenticated user's active subscription. Returns the active subscription if one exists.

**API Frontend Description By The Backend Architect**

Use this endpoint to check if the current user has an active subscription before allowing access to AI features. If a 404 is returned, the user does not have an active subscription and should be prompted to subscribe.

**Rest Route**

The `getMySubscription` API REST controller can be triggered via the following route:

`/v1/my-subscription`


**Rest Request Parameters**
The `getMySubscription` api has got no request parameters.    




**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/my-subscription**
```js
  axios({
    method: 'GET',
    url: '/v1/my-subscription',
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Pricingconfig` API
**[Default get API]** — This is the designated default `get` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Retrieve a pricing configuration record. Accessible to all authenticated users to view current subscription pricing.

**API Frontend Description By The Backend Architect**

Use this endpoint to display the current subscription price to users before they initiate payment.

**Rest Route**

The `getPricingConfig` API REST controller can be triggered via the following route:

`/v1/pricingconfigs/:pricingConfigId`


**Rest Request Parameters**


The `getPricingConfig` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| pricingConfigId  | ID  | true | request.params?.["pricingConfigId"] |
**pricingConfigId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/pricingconfigs/:pricingConfigId**
```js
  axios({
    method: 'GET',
    url: `/v1/pricingconfigs/${pricingConfigId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "pricingConfig",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"pricingConfig": {
		"id": "ID",
		"currency": "String",
		"description": "Text",
		"price": "Integer",
		"type": "Enum",
		"type_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Subscription` API
**[Default get API]** — This is the designated default `get` API for the `subscription` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Retrieve a subscription record by its ID. Owners can view their own subscriptions; admins can view any.


**Rest Route**

The `getSubscription` API REST controller can be triggered via the following route:

`/v1/subscriptions/:subscriptionId`


**Rest Request Parameters**


The `getSubscription` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId  | ID  | true | request.params?.["subscriptionId"] |
**subscriptionId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/subscriptions/:subscriptionId**
```js
  axios({
    method: 'GET',
    url: `/v1/subscriptions/${subscriptionId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Pricingconfigs` API
**[Default list API]** — This is the designated default `list` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all pricing configuration records. Accessible to authenticated users.


**Rest Route**

The `listPricingConfigs` API REST controller can be triggered via the following route:

`/v1/pricingconfigs`


**Rest Request Parameters**
The `listPricingConfigs` api has got no request parameters.    




**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/pricingconfigs**
```js
  axios({
    method: 'GET',
    url: '/v1/pricingconfigs',
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "pricingConfigs",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"pricingConfigs": [
		{
			"id": "ID",
			"currency": "String",
			"description": "Text",
			"price": "Integer",
			"type": "Enum",
			"type_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `List Subscriptions` API
**[Default list API]** — This is the designated default `list` API for the `subscription` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all subscriptions. Admin-only endpoint for monitoring subscription records.


**Rest Route**

The `listSubscriptions` API REST controller can be triggered via the following route:

`/v1/subscriptions`


**Rest Request Parameters**



**Filter Parameters**

The `listSubscriptions` api supports 3 optional filter parameters for filtering list results:

**status** (`Enum`): Current subscription status managed by Stripe payment flow.

- Single: `?status=<value>` (case-insensitive)
- Multiple: `?status=<value1>&status=<value2>`
- Null: `?status=null`


**userId** (`ID`): Reference to the user who owns this subscription.

- Single: `?userId=<value>`
- Multiple: `?userId=<value1>&userId=<value2>`
- Null: `?userId=null`


**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.

- Single: `?paymentConfirmation=<value>` (case-insensitive)
- Multiple: `?paymentConfirmation=<value1>&paymentConfirmation=<value2>`
- Null: `?paymentConfirmation=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/subscriptions**
```js
  axios({
    method: 'GET',
    url: '/v1/subscriptions',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // status: '<value>' // Filter by status
        // userId: '<value>' // Filter by userId
        // paymentConfirmation: '<value>' // Filter by paymentConfirmation
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscriptions",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"subscriptions": [
		{
			"id": "ID",
			"activatedAt": "Date",
			"cancelledAt": "Date",
			"currency": "String",
			"pricePaid": "Integer",
			"status": "Enum",
			"status_idx": "Integer",
			"statusUpdatedAt": "Date",
			"userId": "ID",
			"paymentConfirmation": "Enum",
			"paymentConfirmation_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Update Pricingconfig` API
**[Default update API]** — This is the designated default `update` API for the `pricingConfig` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Update the subscription pricing configuration. Admin-only operation for adjusting price, currency, or description without code deployment.


**Rest Route**

The `updatePricingConfig` API REST controller can be triggered via the following route:

`/v1/pricingconfigs/:pricingConfigId`


**Rest Request Parameters**


The `updatePricingConfig` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| pricingConfigId  | ID  | true | request.params?.["pricingConfigId"] |
| currency  | String  | false | request.body?.["currency"] |
| description  | Text  | false | request.body?.["description"] |
| price  | Integer  | false | request.body?.["price"] |
| type  | Enum  | false | request.body?.["type"] |
**pricingConfigId** : This id paremeter is used to select the required data object that will be updated
**currency** : Currency code for pricing (e.g., usd).
**description** : Human-readable description of the subscription plan.
**price** : Current subscription price in cents (e.g., 999 = $9.99).
**type** : 



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/pricingconfigs/:pricingConfigId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/pricingconfigs/${pricingConfigId}`,
    data: {
            currency:"String",  
            description:"Text",  
            price:"Integer",  
            type:"Enum",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "pricingConfig",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"pricingConfig": {
		"id": "ID",
		"currency": "String",
		"description": "Text",
		"price": "Integer",
		"type": "Enum",
		"type_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Create Subscription` API



**Rest Route**

The `createSubscription` API REST controller can be triggered via the following route:

`/v1/subscriptions`


**Rest Request Parameters**


The `createSubscription` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| activatedAt  | Date  | false | request.body?.["activatedAt"] |
| cancelledAt  | Date  | false | request.body?.["cancelledAt"] |
| currency  | String  | true | request.body?.["currency"] |
| pricePaid  | Integer  | true | request.body?.["pricePaid"] |
| statusUpdatedAt  | Date  | false | request.body?.["statusUpdatedAt"] |
**activatedAt** : Timestamp when the subscription was activated after successful payment.
**cancelledAt** : Timestamp when the subscription was cancelled by the user.
**currency** : Currency code for the payment (e.g., usd).
**pricePaid** : Amount paid in cents at the time of subscription activation.
**statusUpdatedAt** : Timestamp of the last status update, auto-managed by Stripe payment flow.



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/subscriptions**
```js
  axios({
    method: 'POST',
    url: '/v1/subscriptions',
    data: {
            activatedAt:"Date",  
            cancelledAt:"Date",  
            currency:"String",  
            pricePaid:"Integer",  
            statusUpdatedAt:"Date",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Do Test` API



**Rest Route**

The `test` API REST controller can be triggered via the following route:

`/v1/test`


**Rest Request Parameters**
The `test` api has got no request parameters.    




**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/test**
```js
  axios({
    method: 'GET',
    url: '/v1/test',
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "pricingConfigs",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"pricingConfigs": [
		{
			"id": "ID",
			"currency": "String",
			"description": "Text",
			"price": "Integer",
			"type": "Enum",
			"type_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Get Subscriptionpayment` API
This route is used to get the payment information by ID.


**Rest Route**

The `getSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/subscriptionpayment/:sys_subscriptionPaymentId`


**Rest Request Parameters**


The `getSubscriptionPayment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_subscriptionPaymentId  | ID  | true | request.params?.["sys_subscriptionPaymentId"] |
**sys_subscriptionPaymentId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/subscriptionpayment/:sys_subscriptionPaymentId**
```js
  axios({
    method: 'GET',
    url: `/v1/subscriptionpayment/${sys_subscriptionPaymentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_subscriptionPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Subscriptionpayments` API
This route is used to list all payments.


**Rest Route**

The `listSubscriptionPayments` API REST controller can be triggered via the following route:

`/v1/subscriptionpayments`


**Rest Request Parameters**



**Filter Parameters**

The `listSubscriptionPayments` api supports 6 optional filter parameters for filtering list results:

**ownerId** (`ID`):  An ID value to represent owner user who created the order

- Single: `?ownerId=<value>`
- Multiple: `?ownerId=<value1>&ownerId=<value2>`
- Null: `?ownerId=null`


**orderId** (`ID`): an ID value to represent the orderId which is the ID parameter of the source subscription object

- Single: `?orderId=<value>`
- Multiple: `?orderId=<value1>&orderId=<value2>`
- Null: `?orderId=null`


**paymentId** (`String`): A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type

- Single (partial match, case-insensitive): `?paymentId=<value>`
- Multiple: `?paymentId=<value1>&paymentId=<value2>`
- Null: `?paymentId=null`


**paymentStatus** (`String`): A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.

- Single (partial match, case-insensitive): `?paymentStatus=<value>`
- Multiple: `?paymentStatus=<value1>&paymentStatus=<value2>`
- Null: `?paymentStatus=null`


**statusLiteral** (`String`): A string value to represent the logical payment status which belongs to the application lifecycle itself.

- Single (partial match, case-insensitive): `?statusLiteral=<value>`
- Multiple: `?statusLiteral=<value1>&statusLiteral=<value2>`
- Null: `?statusLiteral=null`


**redirectUrl** (`String`): A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.

- Single (partial match, case-insensitive): `?redirectUrl=<value>`
- Multiple: `?redirectUrl=<value1>&redirectUrl=<value2>`
- Null: `?redirectUrl=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/subscriptionpayments**
```js
  axios({
    method: 'GET',
    url: '/v1/subscriptionpayments',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // ownerId: '<value>' // Filter by ownerId
        // orderId: '<value>' // Filter by orderId
        // paymentId: '<value>' // Filter by paymentId
        // paymentStatus: '<value>' // Filter by paymentStatus
        // statusLiteral: '<value>' // Filter by statusLiteral
        // redirectUrl: '<value>' // Filter by redirectUrl
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayments",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"sys_subscriptionPayments": [
		{
			"id": "ID",
			"ownerId": "ID",
			"orderId": "ID",
			"paymentId": "String",
			"paymentStatus": "String",
			"statusLiteral": "String",
			"redirectUrl": "String",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Create Subscriptionpayment` API
This route is used to create a new payment.


**Rest Route**

The `createSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/subscriptionpayment`


**Rest Request Parameters**


The `createSubscriptionPayment` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId  | ID  | true | request.body?.["orderId"] |
| paymentId  | String  | true | request.body?.["paymentId"] |
| paymentStatus  | String  | true | request.body?.["paymentStatus"] |
| statusLiteral  | String  | true | request.body?.["statusLiteral"] |
| redirectUrl  | String  | false | request.body?.["redirectUrl"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source subscription object
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/subscriptionpayment**
```js
  axios({
    method: 'POST',
    url: '/v1/subscriptionpayment',
    data: {
            orderId:"ID",  
            paymentId:"String",  
            paymentStatus:"String",  
            statusLiteral:"String",  
            redirectUrl:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayment",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_subscriptionPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Update Subscriptionpayment` API
This route is used to update an existing payment.


**Rest Route**

The `updateSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/subscriptionpayment/:sys_subscriptionPaymentId`


**Rest Request Parameters**


The `updateSubscriptionPayment` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_subscriptionPaymentId  | ID  | true | request.params?.["sys_subscriptionPaymentId"] |
| paymentId  | String  | false | request.body?.["paymentId"] |
| paymentStatus  | String  | false | request.body?.["paymentStatus"] |
| statusLiteral  | String  | false | request.body?.["statusLiteral"] |
| redirectUrl  | String  | false | request.body?.["redirectUrl"] |
**sys_subscriptionPaymentId** : This id paremeter is used to select the required data object that will be updated
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/subscriptionpayment/:sys_subscriptionPaymentId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/subscriptionpayment/${sys_subscriptionPaymentId}`,
    data: {
            paymentId:"String",  
            paymentStatus:"String",  
            statusLiteral:"String",  
            redirectUrl:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayment",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_subscriptionPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Delete Subscriptionpayment` API
This route is used to delete a payment.


**Rest Route**

The `deleteSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/subscriptionpayment/:sys_subscriptionPaymentId`


**Rest Request Parameters**


The `deleteSubscriptionPayment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_subscriptionPaymentId  | ID  | true | request.params?.["sys_subscriptionPaymentId"] |
**sys_subscriptionPaymentId** : This id paremeter is used to select the required data object that will be deleted



**REST Request**
To access the api you can use the **REST** controller with the path **DELETE  /v1/subscriptionpayment/:sys_subscriptionPaymentId**
```js
  axios({
    method: 'DELETE',
    url: `/v1/subscriptionpayment/${sys_subscriptionPaymentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayment",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_subscriptionPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Subscriptionpaymentbyorderid` API
This route is used to get the payment information by order id.


**Rest Route**

The `getSubscriptionPaymentByOrderId` API REST controller can be triggered via the following route:

`/v1/subscriptionpaymentbyorderid/:orderId`


**Rest Request Parameters**


The `getSubscriptionPaymentByOrderId` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId  | ID  | true | request.params?.["orderId"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source subscription object. The parameter is used to query data.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/subscriptionpaymentbyorderid/:orderId**
```js
  axios({
    method: 'GET',
    url: `/v1/subscriptionpaymentbyorderid/${orderId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_subscriptionPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Subscriptionpaymentbypaymentid` API
This route is used to get the payment information by payment id.


**Rest Route**

The `getSubscriptionPaymentByPaymentId` API REST controller can be triggered via the following route:

`/v1/subscriptionpaymentbypaymentid/:paymentId`


**Rest Request Parameters**


The `getSubscriptionPaymentByPaymentId` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| paymentId  | String  | true | request.params?.["paymentId"] |
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type. The parameter is used to query data.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/subscriptionpaymentbypaymentid/:paymentId**
```js
  axios({
    method: 'GET',
    url: `/v1/subscriptionpaymentbypaymentid/${paymentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_subscriptionPayment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_subscriptionPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Start Subscriptionpayment` API
Start payment for subscription


**Rest Route**

The `startSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/startsubscriptionpayment/:subscriptionId`


**Rest Request Parameters**


The `startSubscriptionPayment` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId  | ID  | true | request.params?.["subscriptionId"] |
| paymentUserParams  | Object  | true | request.body?.["paymentUserParams"] |
**subscriptionId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to start a stripe payment process. Must include paymentMethodId.



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/startsubscriptionpayment/:subscriptionId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/startsubscriptionpayment/${subscriptionId}`,
    data: {
            paymentUserParams:"Object",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	},
	"paymentResult": {
		"paymentTicketId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "Enum",
		"paymentIntentInfo": "Object",
		"statusLiteral": "String",
		"amount": "Double",
		"currency": "String",
		"success": true,
		"description": "String",
		"metadata": "Object",
		"paymentUserParams": "Object"
	}
}
```


### `Refresh Subscriptionpayment` API
Refresh payment info for subscription from Stripe


**Rest Route**

The `refreshSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/refreshsubscriptionpayment/:subscriptionId`


**Rest Request Parameters**


The `refreshSubscriptionPayment` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId  | ID  | true | request.params?.["subscriptionId"] |
| paymentUserParams  | Object  | false | request.body?.["paymentUserParams"] |
**subscriptionId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to refresh a stripe payment process



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/refreshsubscriptionpayment/:subscriptionId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/refreshsubscriptionpayment/${subscriptionId}`,
    data: {
            paymentUserParams:"Object",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	},
	"paymentResult": {
		"paymentTicketId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "Enum",
		"paymentIntentInfo": "Object",
		"statusLiteral": "String",
		"amount": "Double",
		"currency": "String",
		"success": true,
		"description": "String",
		"metadata": "Object",
		"paymentUserParams": "Object"
	}
}
```


### `Callback Subscriptionpayment` API
Refresh payment values by gateway webhook call for subscription


**Rest Route**

The `callbackSubscriptionPayment` API REST controller can be triggered via the following route:

`/v1/callbacksubscriptionpayment`


**Rest Request Parameters**


The `callbackSubscriptionPayment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| subscriptionId  | ID  | false | request.body?.["subscriptionId"] |
**subscriptionId** : The order id parameter that will be read from webhook callback params



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/callbacksubscriptionpayment**
```js
  axios({
    method: 'POST',
    url: '/v1/callbacksubscriptionpayment',
    data: {
            subscriptionId:"ID",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "subscription",
	"method": "POST",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"subscription": {
		"id": "ID",
		"activatedAt": "Date",
		"cancelledAt": "Date",
		"currency": "String",
		"pricePaid": "Integer",
		"status": "Enum",
		"status_idx": "Integer",
		"statusUpdatedAt": "Date",
		"userId": "ID",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	},
	"paymentResult": {
		"paymentTicketId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "Enum",
		"paymentIntentInfo": "Object",
		"statusLiteral": "String",
		"amount": "Double",
		"currency": "String",
		"success": true,
		"description": "String",
		"metadata": "Object",
		"paymentUserParams": "Object"
	}
}
```


### `Get Paymentcustomerbyuserid` API
This route is used to get the payment customer information by user id.


**Rest Route**

The `getPaymentCustomerByUserId` API REST controller can be triggered via the following route:

`/v1/paymentcustomers/:userId`


**Rest Request Parameters**


The `getPaymentCustomerByUserId` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId  | ID  | true | request.params?.["userId"] |
**userId** :  An ID value to represent the user who is created as a stripe customer. The parameter is used to query data.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/paymentcustomers/:userId**
```js
  axios({
    method: 'GET',
    url: `/v1/paymentcustomers/${userId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_paymentCustomer",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_paymentCustomer": {
		"id": "ID",
		"userId": "ID",
		"customerId": "String",
		"platform": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Paymentcustomers` API
This route is used to list all payment customers.


**Rest Route**

The `listPaymentCustomers` API REST controller can be triggered via the following route:

`/v1/paymentcustomers`


**Rest Request Parameters**



**Filter Parameters**

The `listPaymentCustomers` api supports 3 optional filter parameters for filtering list results:

**userId** (`ID`):  An ID value to represent the user who is created as a stripe customer

- Single: `?userId=<value>`
- Multiple: `?userId=<value1>&userId=<value2>`
- Null: `?userId=null`


**customerId** (`String`): A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway

- Single (partial match, case-insensitive): `?customerId=<value>`
- Multiple: `?customerId=<value1>&customerId=<value2>`
- Null: `?customerId=null`


**platform** (`String`): A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.

- Single (partial match, case-insensitive): `?platform=<value>`
- Multiple: `?platform=<value1>&platform=<value2>`
- Null: `?platform=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/paymentcustomers**
```js
  axios({
    method: 'GET',
    url: '/v1/paymentcustomers',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // userId: '<value>' // Filter by userId
        // customerId: '<value>' // Filter by customerId
        // platform: '<value>' // Filter by platform
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_paymentCustomers",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"sys_paymentCustomers": [
		{
			"id": "ID",
			"userId": "ID",
			"customerId": "String",
			"platform": "String",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `List Paymentcustomermethods` API
This route is used to list all payment customer methods.


**Rest Route**

The `listPaymentCustomerMethods` API REST controller can be triggered via the following route:

`/v1/paymentcustomermethods/:userId`


**Rest Request Parameters**


The `listPaymentCustomerMethods` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId  | ID  | true | request.params?.["userId"] |
**userId** :  An ID value to represent the user who owns the payment method. The parameter is used to query data.


**Filter Parameters**

The `listPaymentCustomerMethods` api supports 6 optional filter parameters for filtering list results:

**paymentMethodId** (`String`): A string value to represent the id of the payment method on the payment platform.

- Single (partial match, case-insensitive): `?paymentMethodId=<value>`
- Multiple: `?paymentMethodId=<value1>&paymentMethodId=<value2>`
- Null: `?paymentMethodId=null`


**customerId** (`String`): A string value to represent the customer id which is generated on the payment gateway.

- Single (partial match, case-insensitive): `?customerId=<value>`
- Multiple: `?customerId=<value1>&customerId=<value2>`
- Null: `?customerId=null`


**cardHolderName** (`String`): A string value to represent the name of the card holder. It can be different than the registered customer.

- Single (partial match, case-insensitive): `?cardHolderName=<value>`
- Multiple: `?cardHolderName=<value1>&cardHolderName=<value2>`
- Null: `?cardHolderName=null`


**cardHolderZip** (`String`): A string value to represent the zip code of the card holder. It is used for address verification in specific countries.

- Single (partial match, case-insensitive): `?cardHolderZip=<value>`
- Multiple: `?cardHolderZip=<value1>&cardHolderZip=<value2>`
- Null: `?cardHolderZip=null`


**platform** (`String`): A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.

- Single (partial match, case-insensitive): `?platform=<value>`
- Multiple: `?platform=<value1>&platform=<value2>`
- Null: `?platform=null`


**cardInfo** (`Object`): A Json value to store the card details of the payment method.

- Single: `?cardInfo=<value>`
- Multiple: `?cardInfo=<value1>&cardInfo=<value2>`
- Null: `?cardInfo=null`


**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/paymentcustomermethods/:userId**
```js
  axios({
    method: 'GET',
    url: `/v1/paymentcustomermethods/${userId}`,
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // paymentMethodId: '<value>' // Filter by paymentMethodId
        // customerId: '<value>' // Filter by customerId
        // cardHolderName: '<value>' // Filter by cardHolderName
        // cardHolderZip: '<value>' // Filter by cardHolderZip
        // platform: '<value>' // Filter by platform
        // cardInfo: '<value>' // Filter by cardInfo
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_paymentMethods",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"sys_paymentMethods": [
		{
			"id": "ID",
			"paymentMethodId": "String",
			"userId": "ID",
			"customerId": "String",
			"cardHolderName": "String",
			"cardHolderZip": "String",
			"platform": "String",
			"cardInfo": "Object",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```



**After this prompt, the user may give you new instructions to update the output of this prompt or provide subsequent prompts about the project.**


