# Update Plan

Use this API to update 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/{plan_id}` |
| Production \[PROD]             | `https://api.pluralpay.in/ps/api/v1/public/plans/{plan_id}`       |

> 📘 Note:
>
> * Existing subscriptions under this plan will remain unaffected. The changes will apply only to new subscriptions created under this plan.

# 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/{plan_id}": {
      "patch": {
        "summary": "Update Plan",
        "description": "Use this API to update a plan.",
        "operationId": "update-plan",
        "parameters": [
          {
            "name": "plan_id",
            "in": "path",
            "description": "Unique identifier for the subscription plan in the Plural database.<br><br>Example: `v1-plan-4405071524-aa-qlAtAf`",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "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.022056Z`",
            "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",
                "properties": {
                  "plan_name": {
                    "type": "string",
                    "description": "Subscription plan name.<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`"
                  },
                  "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"
                      }
                    }
                  },
                  "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"
                  },
                  "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"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"plan_name\": \"Monthly Plan\",\n  \"plan_description\": \"Diwali dhammaka plan intended to attract customers on diwali time\",\n  \"amount\": {\n    \"value\": 100,\n    \"currency\": \"INR\"\n  },\n  \"max_limit_amount\": {\n    \"value\": 100,\n    \"currency\": \"INR\"\n  },\n  \"trial_period_in_days\": 1,\n  \"end_date\": \"2022-10-21T17:32:28Z\",\n  \"merchant_metadata\": {\n    \"key1\": \"DD\",\n    \"key2\": \"XOF\"\n  },\n  \"merchant_plan_reference\": \"1234567890\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan_name": {
                      "type": "string",
                      "example": "Monthly Plan"
                    },
                    "plan_description": {
                      "type": "string",
                      "example": "Diwali dhammaka plan intended to attract customers on diwali time"
                    },
                    "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": 100,
                          "default": 0
                        },
                        "currency": {
                          "type": "string",
                          "example": "INR"
                        }
                      }
                    },
                    "trial_period_in_days": {
                      "type": "integer",
                      "example": 1,
                      "default": 0
                    },
                    "end_date": {
                      "type": "string",
                      "example": "2022-10-21T17:32:28Z"
                    },
                    "merchant_metadata": {
                      "type": "object",
                      "properties": {
                        "key1": {
                          "type": "string",
                          "example": "DD"
                        },
                        "key2": {
                          "type": "string",
                          "example": "XOF"
                        }
                      }
                    },
                    "merchant_plan_reference": {
                      "type": "string",
                      "example": "1234567890"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```