{"_id":"59a45d447ee621000fc9d3c9","category":{"_id":"59a45d447ee621000fc9d3c0","version":"59a45d437ee621000fc9d3b7","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-27T10:22:06.636Z","from_sync":false,"order":8,"slug":"subscriptions","title":"Subscriptions"},"project":"57336fd5a6a9c40e00e13a0b","user":"560d5913af97231900938124","parentDoc":null,"version":{"_id":"59a45d437ee621000fc9d3b7","project":"57336fd5a6a9c40e00e13a0b","__v":1,"createdAt":"2017-08-28T18:13:23.840Z","releaseDate":"2017-08-28T18:13:23.840Z","categories":["59a45d447ee621000fc9d3b8","59a45d447ee621000fc9d3b9","59a45d447ee621000fc9d3ba","59a45d447ee621000fc9d3bb","59a45d447ee621000fc9d3bc","59a45d447ee621000fc9d3bd","59a45d447ee621000fc9d3be","59a45d447ee621000fc9d3bf","59a45d447ee621000fc9d3c0","59a45d447ee621000fc9d3c1","59a45d447ee621000fc9d3c2","59a45d447ee621000fc9d3c3","59a45d447ee621000fc9d3c4","59a45d447ee621000fc9d3c5","59a45d447ee621000fc9d3c6","59a45d447ee621000fc9d3c7"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"3.22.1","version_clean":"8976.0.0-XML","version":"8976-XML"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-29T12:00:30.497Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"post","results":{"codes":[{"language":"text","code":""}]},"settings":"","auth":"optional","params":[],"url":"/recurring/plans"},"isReference":false,"order":19,"body":"The Create Plan request enables you to set up a subscription billing plan and define the plan's settings, such as the charge frequency, amount, currency, trial period, initial charge amount, and so on.\n\nFor more information about working with subscriptions, see the [Subscriptions tutorial](doc:subscription-management#section-tutorial-subscriptions).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Need help setting up your plans?\",\n  \"body\": \"If you need assistance with creating billing plans, please contact merchant support at [merchants:::at:::bluesnap.com](mailto:merchants@bluesnap.com).\"\n}\n[/block]\n<a class=\"btn btn-success\" href=\"#section-api-explorer\" role=\"button\">Try it in the API Explorer</a>\n\n###Request Content\n`plan` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>, contains the following properties (see [plan](doc:plan)):\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`name` *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`recurring-charge-amount` *decimal* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`currency` *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`charge-frequency` *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`trial-period-days` *integer* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`initial-charge-amount` *decimal* &nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`charge-on-plan-switch` *boolean* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`max-number-of-charges` *integer* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`grace-period-days` *integer* &nbsp;&nbsp;&nbsp;optional\n\n###Response Details\nIf successful, the response HTTP status code is 200 OK.\nThe response body contains the [plan](doc:plan) resource, which includes the `plan-id`.\nThe `plan-id` also appears in the location header.\n\n<hr>\n\n##Examples\n\n###Request Examples\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<plan xmlns=\\\"http://ws.plimus.com\\\">\\n   <name>Gold Plan</name>\\n   <recurring-charge-amount>29.99</recurring-charge-amount>\\n   <currency>USD</currency>\\n   <charge-frequency>MONTHLY</charge-frequency>\\n</plan>'\",\n      \"language\": \"curl\",\n      \"name\": \"Create Plan Request: basic\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<plan xmlns=\\\"http://ws.plimus.com\\\">\\n   <name>Gold Plan</name>\\n   <recurring-charge-amount>29.99</recurring-charge-amount>\\n   <currency>USD</currency>\\n   <charge-frequency>MONTHLY</charge-frequency>\\n   <trial-period-days>14</trial-period-days>\\n   <initial-charge-amount>100</initial-charge-amount>\\n   <charge-on-plan-switch>true</charge-on-plan-switch>\\n   <max-number-of-charges>12</max-number-of-charges>\\n   <grace-period-days>10</grace-period-days>\\n</plan>'\",\n      \"language\": \"curl\",\n      \"name\": \"with all settings\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n###Response Examples\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/ 1.1 200 OK\\n\\n<plan xmlns=\\\"http://ws.plimus.com\\\">\\n   <plan-id>2111110</plan-id>\\n   <name>Gold Plan</name>\\n   <recurring-charge-amount>29.99</recurring-charge-amount>\\n   <currency>USD</currency>\\n   <charge-frequency>MONTHLY</charge-frequency>\\n   <status>ACTIVE</status>\\n</plan>\",\n      \"language\": \"xml\",\n      \"name\": \"Create Plan Response: 200 OK - basic\"\n    },\n    {\n      \"code\": \"HTTP/ 1.1 200 OK\\n\\n<plan xmlns=\\\"http://ws.plimus.com\\\">\\n   <plan-id>2111111</plan-id>\\n   <name>Gold Plan</name>\\n   <recurring-charge-amount>29.99</recurring-charge-amount>\\n   <currency>USD</currency>\\n   <charge-frequency>MONTHLY</charge-frequency>\\n   <trial-period-days>14</trial-period-days>\\n   <initial-charge-amount>100</initial-charge-amount>\\n   <charge-on-plan-switch>true</charge-on-plan-switch>\\n   <max-number-of-charges>12</max-number-of-charges>\\n   <grace-period-days>10</grace-period-days>\\n   <status>ACTIVE</status>\\n</plan>\",\n      \"language\": \"xml\",\n      \"name\": \"200 OK - with all settings\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n\n<hr>\n\n##Example Descriptions\n\n###Create Plan: basic\nThis example shows a basic Create Plan request, containing the minimum required fields for a new plan.\n\n###Create Plan: all settings\nThis example shows a Create Plan request with all available plan settings, including a trial period of 14 days, an initial charge of $100, charge on switch enabled, a max limit of 12 charges, and a grace period of 10 days.\n\n<br>\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n\n<hr>\n\n##API Explorer\nTo test out a call, enter the XML portion of the request below and then click **Try it!**\n\n**Tip**: Copy the XML portion from one of the example requests above, or use the XML code below as a starting point. You can enter different parameter values to see how your test scenario would work. *The request headers, including authorization, are already built in for you in this test area, so you should not include them here.*\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<plan xmlns=\\\"http://ws.plimus.com\\\">\\n   <name>Gold Plan</name>\\n   <recurring-charge-amount>29.99</recurring-charge-amount>\\n   <currency>USD</currency>\\n   <charge-frequency>MONTHLY</charge-frequency>\\n   <trial-period-days>14</trial-period-days>\\n   <initial-charge-amount>100</initial-charge-amount>\\n   <charge-on-plan-switch>true</charge-on-plan-switch>\\n   <max-number-of-charges>12</max-number-of-charges>\\n   <grace-period-days>10</grace-period-days>\\n</plan>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"create-plan","type":"post","title":"Create Plan"}

Definition

{{ api_url }}{{ page_api_url }}

Documentation

The Create Plan request enables you to set up a subscription billing plan and define the plan's settings, such as the charge frequency, amount, currency, trial period, initial charge amount, and so on.

For more information about working with subscriptions, see the Subscriptions tutorial.

Need help setting up your plans?

If you need assistance with creating billing plans, please contact merchant support at merchants@bluesnap.com.

Try it in the API Explorer

Request Content

plan container    required, contains the following properties (see plan):
      name string    required
      recurring-charge-amount decimal    required
      currency string    required
      charge-frequency string    required
      trial-period-days integer    optional
      initial-charge-amount decimal   optional
      charge-on-plan-switch boolean    optional
      max-number-of-charges integer    optional
      grace-period-days integer    optional

Response Details

If successful, the response HTTP status code is 200 OK.
The response body contains the plan resource, which includes the plan-id.
The plan-id also appears in the location header.


Examples

Request Examples

curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<plan xmlns="http://ws.plimus.com">
   <name>Gold Plan</name>
   <recurring-charge-amount>29.99</recurring-charge-amount>
   <currency>USD</currency>
   <charge-frequency>MONTHLY</charge-frequency>
</plan>'
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<plan xmlns="http://ws.plimus.com">
   <name>Gold Plan</name>
   <recurring-charge-amount>29.99</recurring-charge-amount>
   <currency>USD</currency>
   <charge-frequency>MONTHLY</charge-frequency>
   <trial-period-days>14</trial-period-days>
   <initial-charge-amount>100</initial-charge-amount>
   <charge-on-plan-switch>true</charge-on-plan-switch>
   <max-number-of-charges>12</max-number-of-charges>
   <grace-period-days>10</grace-period-days>
</plan>'

Response Examples

HTTP/ 1.1 200 OK

<plan xmlns="http://ws.plimus.com">
   <plan-id>2111110</plan-id>
   <name>Gold Plan</name>
   <recurring-charge-amount>29.99</recurring-charge-amount>
   <currency>USD</currency>
   <charge-frequency>MONTHLY</charge-frequency>
   <status>ACTIVE</status>
</plan>
HTTP/ 1.1 200 OK

<plan xmlns="http://ws.plimus.com">
   <plan-id>2111111</plan-id>
   <name>Gold Plan</name>
   <recurring-charge-amount>29.99</recurring-charge-amount>
   <currency>USD</currency>
   <charge-frequency>MONTHLY</charge-frequency>
   <trial-period-days>14</trial-period-days>
   <initial-charge-amount>100</initial-charge-amount>
   <charge-on-plan-switch>true</charge-on-plan-switch>
   <max-number-of-charges>12</max-number-of-charges>
   <grace-period-days>10</grace-period-days>
   <status>ACTIVE</status>
</plan>

Back to Top


Example Descriptions

Create Plan: basic

This example shows a basic Create Plan request, containing the minimum required fields for a new plan.

Create Plan: all settings

This example shows a Create Plan request with all available plan settings, including a trial period of 14 days, an initial charge of $100, charge on switch enabled, a max limit of 12 charges, and a grace period of 10 days.



Back to Top


API Explorer

To test out a call, enter the XML portion of the request below and then click Try it!

Tip: Copy the XML portion from one of the example requests above, or use the XML code below as a starting point. You can enter different parameter values to see how your test scenario would work. The request headers, including authorization, are already built in for you in this test area, so you should not include them here.

<plan xmlns="http://ws.plimus.com">
   <name>Gold Plan</name>
   <recurring-charge-amount>29.99</recurring-charge-amount>
   <currency>USD</currency>
   <charge-frequency>MONTHLY</charge-frequency>
   <trial-period-days>14</trial-period-days>
   <initial-charge-amount>100</initial-charge-amount>
   <charge-on-plan-switch>true</charge-on-plan-switch>
   <max-number-of-charges>12</max-number-of-charges>
   <grace-period-days>10</grace-period-days>
</plan>

User Information

Try It Out


post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}