{"_id":"59dfa5848b51880010b74adb","category":{"_id":"59dfa5828b51880010b74abe","version":"59dfa5828b51880010b74ab6","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-27T10:22:06.636Z","from_sync":false,"order":7,"slug":"subscriptions","title":"Subscriptions"},"parentDoc":null,"project":"57336fd5a6a9c40e00e13a0b","user":"560d5913af97231900938124","version":{"_id":"59dfa5828b51880010b74ab6","project":"57336fd5a6a9c40e00e13a0b","__v":1,"createdAt":"2017-10-12T17:25:22.850Z","releaseDate":"2017-10-12T17:25:22.850Z","categories":["59dfa5828b51880010b74ab7","59dfa5828b51880010b74ab8","59dfa5828b51880010b74ab9","59dfa5828b51880010b74aba","59dfa5828b51880010b74abb","59dfa5828b51880010b74abc","59dfa5828b51880010b74abd","59dfa5828b51880010b74abe","59dfa5828b51880010b74abf","59dfa5828b51880010b74ac0","59dfa5828b51880010b74ac1","59dfa5828b51880010b74ac2","59dfa5828b51880010b74ac3","59dfa5828b51880010b74ac4","59dfa5828b51880010b74ac5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"3.23 Release","version_clean":"8976.0.0-JSON","version":"8976-JSON"},"__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":[{"code":"","language":"text"}]},"settings":"57ee593a21ceb20e0061959e","auth":"optional","params":[],"url":"/recurring/plans"},"isReference":false,"order":0,"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\nSend a **[plan](doc:plan)** object, with the following:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`chargeFrequency` &nbsp;&nbsp;&nbsp; *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`gracePeriodDays` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`trialPeriodDays` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`initialChargeAmount` &nbsp;&nbsp;&nbsp; *decimal* &nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`name` &nbsp;&nbsp;&nbsp; *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`currency` &nbsp;&nbsp;&nbsp; *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`maxNumberOfCharges` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`recurringChargeAmount` &nbsp;&nbsp;&nbsp; *decimal* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`chargeOnPlanSwitch` &nbsp;&nbsp;&nbsp; *boolean* &nbsp;&nbsp;&nbsp;optional\n\n###Response Details\nIf successful, the response HTTP status code is 200 OK.\nThe response contains the **[plan](doc:plan)** object. \nThe `planId` appears in the response body and 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/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n    \\\"name\\\": \\\"Gold Plan\\\",\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"recurringChargeAmount\\\": 29.99\\n}'\",\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/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n    \\\"gracePeriodDays\\\": 10,\\n    \\\"trialPeriodDays\\\": 14,\\n    \\\"initialChargeAmount\\\": 100,\\n    \\\"name\\\": \\\"Gold Plan\\\",\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"maxNumberOfCharges\\\": 12,\\n    \\\"recurringChargeAmount\\\": 29.99,\\n    \\\"chargeOnPlanSwitch\\\": true\\n}'\",\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\": \"{\\n    \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n    \\\"name\\\": \\\"Gold Plan\\\",\\n    \\\"planId\\\": 2111110,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"recurringChargeAmount\\\": 29.99,\\n    \\\"status\\\": \\\"ACTIVE\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Create Plan Response: 200 OK - basic\"\n    },\n    {\n      \"code\": \"{\\n    \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n    \\\"gracePeriodDays\\\": 10,\\n    \\\"trialPeriodDays\\\": 14,\\n    \\\"initialChargeAmount\\\": 100,\\n    \\\"name\\\": \\\"Gold Plan\\\",\\n    \\\"planId\\\": 2111111,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"maxNumberOfCharges\\\": 12,\\n    \\\"recurringChargeAmount\\\": 29.99,\\n    \\\"chargeOnPlanSwitch\\\": true,\\n    \\\"status\\\": \\\"ACTIVE\\\"\\n}\",\n      \"language\": \"json\",\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 request content below and then click **Try it!**\n\n**Tip**: Use the JSON code below as a starting point. You can enter different parameters 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\": \"{\\n    \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n    \\\"gracePeriodDays\\\": 10,\\n    \\\"trialPeriodDays\\\": 14,\\n    \\\"initialChargeAmount\\\": 100,\\n    \\\"name\\\": \\\"Gold Plan\\\",\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"maxNumberOfCharges\\\": 12,\\n    \\\"recurringChargeAmount\\\": 29.99,\\n    \\\"chargeOnPlanSwitch\\\": true\\n}\",\n      \"language\": \"json\"\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

Send a plan object, with the following:

      chargeFrequency     string    required

      gracePeriodDays     integer    optional

      trialPeriodDays     integer    optional

      initialChargeAmount     decimal   optional

      name     string    required

      currency     string    required

      maxNumberOfCharges     integer    optional

      recurringChargeAmount     decimal    required

      chargeOnPlanSwitch     boolean    optional

Response Details

If successful, the response HTTP status code is 200 OK.
The response contains the plan object.
The planId appears in the response body and the location header.


Examples

Request Examples

curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "chargeFrequency": "MONTHLY",
    "name": "Gold Plan",
    "currency": "USD",
    "recurringChargeAmount": 29.99
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/plans \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "chargeFrequency": "MONTHLY",
    "gracePeriodDays": 10,
    "trialPeriodDays": 14,
    "initialChargeAmount": 100,
    "name": "Gold Plan",
    "currency": "USD",
    "maxNumberOfCharges": 12,
    "recurringChargeAmount": 29.99,
    "chargeOnPlanSwitch": true
}'

Response Examples

{
    "chargeFrequency": "MONTHLY",
    "name": "Gold Plan",
    "planId": 2111110,
    "currency": "USD",
    "recurringChargeAmount": 29.99,
    "status": "ACTIVE"
}
{
    "chargeFrequency": "MONTHLY",
    "gracePeriodDays": 10,
    "trialPeriodDays": 14,
    "initialChargeAmount": 100,
    "name": "Gold Plan",
    "planId": 2111111,
    "currency": "USD",
    "maxNumberOfCharges": 12,
    "recurringChargeAmount": 29.99,
    "chargeOnPlanSwitch": true,
    "status": "ACTIVE"
}

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 request content below and then click Try it!

Tip: Use the JSON code below as a starting point. You can enter different parameters 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.

{
    "chargeFrequency": "MONTHLY",
    "gracePeriodDays": 10,
    "trialPeriodDays": 14,
    "initialChargeAmount": 100,
    "name": "Gold Plan",
    "currency": "USD",
    "maxNumberOfCharges": 12,
    "recurringChargeAmount": 29.99,
    "chargeOnPlanSwitch": true
}

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 }}