# Create Plan

Use this API to create a Plan.

## Environment

Use our UAT environment endpoint for testing and for integration utilize our production endpoint.

| Environment                    | Endpoints                                               |
| :----------------------------- | :------------------------------------------------------ |
| User Acceptance Testing \[UAT] | `https://pluraluat.v2.pinepg.in/ps/api/v1/public/plans` |
| Production \[PROD]             | `https://api.pluralpay.in/ps/api/v1/public/plans`       |

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "subscription",
    "version": "3.0"
  },
  "servers": [
    {
      "url": "https://pluraluat.v2.pinepg.in/ps/api/v1/public"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-bearer-format": "bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/plans": {
      "post": {
        "summary": "Create Plan",
        "description": "Use this API to create a Plan.",
        "operationId": "create-plan",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "The type of content included in the HTTP message body.<br><br>Possible value: `application/json`.",
            "schema": {
              "type": "string",
              "default": "application/json"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "The HTTP header where you can include your secret token for authentication.<br><br>Example: `Bearer <access_token>`<br><br>**Note**: Use the access token generated using our <a href=\"https://developer.pluralonline.com/v3.0/reference/generate-token\" target=\"_blank\">Generate Token API</a>.",
            "required": true,
            "schema": {
              "type": "string",
              "default": "Bearer"
            }
          },
          {
            "name": "Request-Timestamp",
            "in": "header",
            "description": "Use ISO 8601 UTC Timestamp, to create a timestamp when the generate token is requested.<br><br>Example: `2024-07-09T07:57:08.022Z`",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Request-ID",
            "in": "header",
            "description": "Use a global unique identifier [GUID] for the request.<ul><li>Minimum: 1 characters.</li><li>Maximum: 50 characters</ul></li>Example: `c17ce30f-f88e-4f81-ada1-c3b4909ed235`",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "plan_name",
                  "frequency",
                  "amount",
                  "max_limit_amount",
                  "end_date",
                  "merchant_plan_reference"
                ],
                "properties": {
                  "plan_name": {
                    "type": "string",
                    "description": "Unique reference for the plan you want to create.<br><br>Example: `Monthly Plan`"
                  },
                  "plan_description": {
                    "type": "string",
                    "description": "Corresponding description for a plan.<br><br>Example: `Diwali dhammaka plan intended to attract customers on diwali time`"
                  },
                  "frequency": {
                    "type": "string",
                    "description": "Frequency of recurring transactions for this particular plan.<ul><li>Day</li><li>Week</li><li>Month</li><li>Year</li><li>Bi-Monthly</li><li>Quarterly</li><li>Half-Yearly</li><li>AS (As & When Presented)</li><li>OT (One Time)</li></ul>Example:`Day`"
                  },
                  "amount": {
                    "type": "object",
                    "description": "An object that contains the amount details.",
                    "required": [
                      "value",
                      "currency"
                    ],
                    "properties": {
                      "value": {
                        "type": "integer",
                        "description": "Transaction amount is Paisa.<ul><li>Minimum value: `100` (₹1)</li><li>Maximum value: `100000000` (₹10 lakh).</ul></li>Example: `1000`",
                        "format": "int32"
                      },
                      "currency": {
                        "type": "string",
                        "description": "Type of currency.<br><br>Example: INR"
                      }
                    }
                  },
                  "max_limit_amount": {
                    "type": "object",
                    "description": "An object that contains the maximum limit amount details.",
                    "required": [
                      "value",
                      "currency"
                    ],
                    "properties": {
                      "value": {
                        "type": "integer",
                        "description": "Transaction amount is Paisa.<ul><li>Minimum value: `100` (₹1)</li><li>Maximum value: `100000000` (₹10 lakh).</ul></li>Example: `1000`",
                        "format": "int32"
                      },
                      "currency": {
                        "type": "string",
                        "description": "Type of currency.<br><br>Example: INR"
                      }
                    }
                  },
                  "initial_debit_amount": {
                    "type": "object",
                    "description": "The amount debited at the time of subscription creation, before the recurring payment cycle starts.",
                    "properties": {
                      "value": {
                        "type": "string",
                        "description": "Transaction amount is Paisa.<ul><li>Minimum value: `100` (₹1)</li><li>Maximum value: `100000000` (₹10 lakh).</ul></li>Example: `1000`<br><br>**Note**: The default initial debit amount is zero unless specified."
                      },
                      "currency": {
                        "type": "string",
                        "description": "Type of currency.<br><br>Example: INR"
                      }
                    }
                  },
                  "trial_period_in_days": {
                    "type": "integer",
                    "description": "When a trial period is offered for the plan, this defines the duration of the trial period.<br><br>Example: `1`",
                    "format": "int32"
                  },
                  "start_date": {
                    "type": "string",
                    "description": "The ISO 8601 UTC Timestamp is the date when the subscription plan is active and available for use.<br><br>Example: `2022-02-01T17:32:28Z`"
                  },
                  "end_date": {
                    "type": "string",
                    "description": "The ISO 8601 UTC Timestamp is the date when the subscription plan expires and can no longer be used for new subscriptions.<br><br>Example: `2022-09-21T17:32:28Z`"
                  },
                  "merchant_metadata": {
                    "type": "object",
                    "description": "An object of key value pair that can be used to store additional information.<ul><li>Each pair cannot exceed `256` characters.</li><li>Maximum `10` key-value pairs.</ul></li>Example: `\"key1\": \"DD\"`",
                    "properties": {
                      "key_1": {
                        "type": "string"
                      },
                      "key_2": {
                        "type": "string"
                      }
                    }
                  },
                  "merchant_plan_reference": {
                    "type": "string",
                    "description": "Unique identifier of the merchant plan reference entered while creating a plan.<ul><li>Minimum: 1 characters.</li><li>Maximum: 50 characters</ul></li>Example: `1234567890`<br><br>Supported characters:<ul><li>`A-Z`</li><li>`a-z`</li><li>`-`</li><li>`_`</ul></li>"
                  },
                  "auto_debit_ot": {
                    "type": "string",
                    "description": "Indicates whether auto-debit is enabled for one-time payments under the subscription plan.<ul><li>false</li><li>True</li> </ul>Example:`false`"
                  }
                }
              },
              "examples": {
                "Create Plan": {
                  "value": {
                    "plan_name": "Monthly Plan 2025-06-12T06:16:47.175Z",
                    "plan_description": "Diwali dhammaka plan intended to attract customers on diwali time",
                    "frequency": "Month",
                    "amount": {
                      "value": 100,
                      "currency": "INR"
                    },
                    "max_limit_amount": {
                      "value": 210,
                      "currency": "INR"
                    },
                    "initial_debit_amount": {
                      "value": 110,
                      "currency": "INR"
                    },
                    "trial_period_in_days": 0,
                    "end_date": "2026-10-21T12:02:28Z",
                    "merchant_metadata": {
                      "key1": "DD"
                    },
                    "merchant_plan_reference": "9856c70c-a0c3-4c03-b537-9ed7c80bc97e",
                    "auto_debit_ot": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"plan_id\": \"v1-pla-250612061639-aa-666Zge\",\n    \"status\": \"ACTIVE\",\n    \"plan_name\": \"Monthly Plan 2025-06-12T06:16:37.364Z\",\n    \"plan_description\": \"Diwali dhammaka plan intended to attract customers on diwali time\",\n    \"frequency\": \"Month\",\n    \"amount\": {\n        \"value\": 100,\n        \"currency\": \"INR\"\n    },\n    \"max_limit_amount\": {\n        \"value\": 210,\n        \"currency\": \"INR\"\n    },\n    \"trial_period_in_days\": 0,\n    \"start_date\": \"2025-06-12T06:16:39.92710492Z\",\n    \"end_date\": \"2026-10-21T12:02:28Z\",\n    \"merchant_metadata\": {\n        \"key1\": \"DD\"\n    },\n    \"merchant_plan_reference\": \"b41770ac-cd3a-48d3-9e93-7dc9246b4751\",\n    \"created_at\": \"2025-06-12T06:16:39.933117Z\",\n    \"modified_at\": \"2025-06-12T06:16:39.93313Z\",\n    \"initial_debit_amount\": {\n        \"value\": 110,\n        \"currency\": \"INR\"\n    },\n    \"auto_debit_ot\": false\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan_id": {
                      "type": "string",
                      "example": "v1-pla-250612061639-aa-666Zge"
                    },
                    "status": {
                      "type": "string",
                      "example": "ACTIVE"
                    },
                    "plan_name": {
                      "type": "string",
                      "example": "Monthly Plan 2025-06-12T06:16:37.364Z"
                    },
                    "plan_description": {
                      "type": "string",
                      "example": "Diwali dhammaka plan intended to attract customers on diwali time"
                    },
                    "frequency": {
                      "type": "string",
                      "example": "Month"
                    },
                    "amount": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "integer",
                          "example": 100,
                          "default": 0
                        },
                        "currency": {
                          "type": "string",
                          "example": "INR"
                        }
                      }
                    },
                    "max_limit_amount": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "integer",
                          "example": 210,
                          "default": 0
                        },
                        "currency": {
                          "type": "string",
                          "example": "INR"
                        }
                      }
                    },
                    "trial_period_in_days": {
                      "type": "integer",
                      "example": 0,
                      "default": 0
                    },
                    "start_date": {
                      "type": "string",
                      "example": "2025-06-12T06:16:39.92710492Z"
                    },
                    "end_date": {
                      "type": "string",
                      "example": "2026-10-21T12:02:28Z"
                    },
                    "merchant_metadata": {
                      "type": "object",
                      "properties": {
                        "key1": {
                          "type": "string",
                          "example": "DD"
                        }
                      }
                    },
                    "merchant_plan_reference": {
                      "type": "string",
                      "example": "b41770ac-cd3a-48d3-9e93-7dc9246b4751"
                    },
                    "created_at": {
                      "type": "string",
                      "example": "2025-06-12T06:16:39.933117Z"
                    },
                    "modified_at": {
                      "type": "string",
                      "example": "2025-06-12T06:16:39.93313Z"
                    },
                    "initial_debit_amount": {
                      "type": "object",
                      "properties": {
                        "value": {
                          "type": "integer",
                          "example": 110,
                          "default": 0
                        },
                        "currency": {
                          "type": "string",
                          "example": "INR"
                        }
                      }
                    },
                    "auto_debit_ot": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"code\": \"INVALID_REQUEST\",\n  \"message\": \"Amount must be an Integer value greater than or equal to 1\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "INVALID_REQUEST"
                    },
                    "message": {
                      "type": "string",
                      "example": "Amount must be an Integer value greater than or equal to 1"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "422",
            "content": {
              "application/json": {
                "examples": {
                  "Duplicate Request": {
                    "value": "{\n  \"code\": \"DUPLICATE_REQUEST\",\n  \"message\": \"Duplicate Merchant Reference ID received\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "DUPLICATE_REQUEST"
                    },
                    "message": {
                      "type": "string",
                      "example": "Duplicate Merchant Reference ID received"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "500",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"code\": \"INTERNAL_ERROR\",\n  \"message\": \"Internal Server Error\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "example": "INTERNAL_ERROR"
                    },
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```