{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/recurring/plans","auth":"optional","examples":{"codes":[]},"method":"post","results":{"codes":[{"code":"","language":"text"}]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Create Plan","type":"endpoint","slug":"create-plan","excerpt":"","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](https://bluesnap.zendesk.com/hc/en-us/requests/new?ticket_form_id=360000127087).\"\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* <span style=\"color:#F37500\">**required**</span>, contains the following properties (see [plan](doc:plan)):\n `name` *string* <span style=\"color:#F37500\">**required**</span>\n `recurring-charge-amount` *decimal* <span style=\"color:#F37500\">**required**</span>\n `currency` *string* <span style=\"color:#F37500\">**required**</span>\n `charge-frequency` *string* <span style=\"color:#F37500\">**required**</span>\n `trial-period-days` *integer* optional\n `initial-charge-amount` *decimal* optional\n `charge-on-plan-switch` *boolean* optional\n `max-number-of-charges` *integer* optional\n `grace-period-days` *integer* 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[block:callout]\n{\n \"type\": \"info\",\n \"title\": \"Tip:\",\n \"body\": \"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}\n[/block]\n\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]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5fd26704abd1b6004f12d6f1","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Subscriptions","slug":"subscriptions","order":11,"from_sync":false,"reference":false,"_id":"5fd26704abd1b6004f12d67b","version":"5fd26704abd1b6004f12d72c","project":"57336fd5a6a9c40e00e13a0b","createdAt":"2016-07-27T10:22:06.636Z","__v":0},"project":"57336fd5a6a9c40e00e13a0b","user":"560d5913af97231900938124","parentDoc":null,"version":{"version":"8976-XML","version_clean":"8976.0.0-XML","codename":"3.36 Release","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5fd26704abd1b6004f12d673","5fd26704abd1b6004f12d674","5fd26704abd1b6004f12d675","5fd26704abd1b6004f12d676","5fd26704abd1b6004f12d677","5fd26704abd1b6004f12d678","5fd26704abd1b6004f12d679","5fd26704abd1b6004f12d67a","5fd26704abd1b6004f12d67b","5fd26704abd1b6004f12d67c","5fd26704abd1b6004f12d67d","5fd26704abd1b6004f12d67e","5fd26704abd1b6004f12d67f","5fd26704abd1b6004f12d680","5fd26704abd1b6004f12d681","5fd26704abd1b6004f12d682","5fd26704abd1b6004f12d683","5fd26704abd1b6004f12d684","5fd26704abd1b6004f12d685","5fd97a5a79ae260012a454d2"],"_id":"5fd26704abd1b6004f12d72c","project":"57336fd5a6a9c40e00e13a0b","__v":1,"forked_from":"5f43d7f192d43e01ff6f11c2","createdAt":"2018-04-24T15:24:22.608Z","releaseDate":"2018-04-24T15:24:22.608Z"},"createdAt":"2016-07-29T12:00:30.497Z","githubsync":"","__v":0}
postCreate Plan
Definition
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.
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>'
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>
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.
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>