Create a New Version of a Plan

POST /subscriptionsplans/plans/plan_id/newversion

With this request, you can create a new version of a plan by copying an existing plan with all its values, while incrementing the version. This makes it easy, for example, for you to reuse the characteristics of a plan you are already using, with minimal effort on your part.

Note the following restrictions:

  • None of the elements is mandatory. However, if you provide values for any plan elements in the request to the newversion endpoint, those values will overwrite the values of the plan being copied.
  • If you provide a name that is different from the name of the plan that you are copying, the version will be set to 1 and not incremented. In effect, this creates a new plan instead of a new version of a plan.
  • You can create a new version of an existing plan only if the plan you are copying has the status of INITIAL or ACTIVE.
  • You can create only one new version of an existing plan with the same value for the name element. If you want to create a third version of a plan with the same name, take the ID returned in the response to the first new version creation request based on that plan, and include it in a new request to the newversion endpoint. For example, if you create a new version of a plan, the version number in the response will be incremented to 2. If you take the ID from that response and send a new request to the newversion endpoint, the version number in that response will be incremented to 3.

To create a new version of a plan, you must initiate a POST request to the newversion endpoint. In the example below, you are creating a new version of the plan, but with the amount modified to 9500.

Before trying the example, you should:

  • Replace the plan ID (e067d83f-add7-4b6b-8884-dfa8693dde1f) with the id you received in the response to your plan creation request.
  • Replace the API key (after the -u) with the Test API key you have received.
Request Example
curl -X POST https://api.test.paysafe.com/subscriptionsplans/v1/plans/e067d83f-add7-4b6b-8884-dfa8693dde1f/newversion \
  -u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
  -H 'Content-Type: application/json' \
  -d ' {
	"amount": "9500"
} '
Response Example
{
	"id": "rtr7d83f-add7-4b6b-8884-dfa8693ddrtr",
	"version": 2,
	"name": "Gold",
	"description": "Gold plan for Elite members",
	"amount": "9500",
	"currencyCode": "USD",
	"billingCycle": {
		"frequency": "MONTHLY",
		"interval": "1"
	},
	"startDate": "2018-03-01",
	"endDate": "2019-03-31",
	"status": "INITIAL",
	"creationTime": "2018-02-14T15:12:18Z",
	"lastUpdatedTime": "2018-02-14T15:12:18Z",
	"links": [{
			"rel": "self",
			"href": "https://api.test.paysafe.com/subscriptionsplans/v1/plans/rtr7d83f-add7-4b6b-8884-dfa8693ddrtr"
		},
		{
			"rel": "subscriptions",
			"href": "https://api.test.paysafe.com/subscriptionsplans/v1/plans/rtr7d83f-add7-4b6b-8884-dfa8693ddrtr/subscriptions"
		},
		{
			"rel": "previousVersion",
			"href": "https://api.test.paysafe.com/subscriptionsplans/v1/plans/e067d83f-add7-4b6b-8884-dfa8693dde1f"
		}
	]
}

For a description of the elements in the request and response for this example, see Create a Plan.

For a complete list and description of the elements and values associated with a plan, consult the plan creation API request.

Did you find this page useful?