On This Page

{#jumplink-list}  
[Markdown](/docs/cybs/en-us/recurring-billing/developer/all/rest/recurring-billing-dev/recur-bill-plans-intro/recur-bill-creating-a-plan.md)  
Filter  
FILTER BY TAG

Creating a Plan {#recur-bill-creating-a-plan}
=============================================

Create a plan to define the billing schedule, which includes the amount, frequency, and billing cycles for a subscription. The interval between subscription payments cannot exceed 12 months. IMPORTANT If a subscription is to use a one-time plan instead of a standard plan, you create the one-time plan when you create the subscription. The plan details are embedded in the subscription request.  
When you create a plan, the system assigns an ID to the plan. Use the plan ID to request these actions:

* Creating a subscription
* Retrieving a plan
* Amending a plan
* Activating a plan
* Deactivating a plan
* Deleting a plan  
  Follow these steps to create a plan:

1. Send the request to the recurring billing endpoint:
   * **Production:** `POST https://api.cybersource.com/rbs/v1/plans`
   * **Test:** `POST https://apitest.cybersource.test.com/rbs/v1/plans`
2. Verify that the request was successful. A 200-level HTTP response code indicates success. For information about response codes, see [Transaction Response Codes](https://developer.cybersource.com/api/reference/response-codes.md "").{#recur-bill-creating-a-plan_d9e19}

Required Fields for Creating a Plan {#recur-bill-create-plan-reqd-fields}
=========================================================================

Include these fields in your request to create a plan:

orderInformation.amountDetails.billingAmount
:

orderInformation.amountDetails.currency
:

planInformation.billingCycles.total
:
Required for a plan with a defined plan period.

planInformation.billingPeriod.length
:

planInformation.billingPeriod.unit
:

planInformation.name
:

Related Information
-------------------

* [API field reference guide for the REST API](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/rest/api-fields/rest-api-fields-intro.md "")

Optional Fields for Creating a Plan {#recur-bill-create-plan-opt-fields}
========================================================================

orderInformation.amountDetails.setupFee
:

planInformation.code
:

planInformation.description
:

planInformation.status
:

Related Information
-------------------

* [API field reference guide for the REST API](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/rest/api-fields/rest-api-fields-intro.md "")

REST Example: Creating a Plan {#recur-bill-create-a-plan-examples}
==================================================================

Request

```
{
    "planInformation": {
        "billingPeriod": {
            "unit": "w",
            "length": "1"
        },
        "billingCycles":
        {
            "total": "4"
        },
        "code":"1619310018",
        "name": "Test plan",
        "description": "Description",
        "status":"active"
    },
    "orderInformation": {
        "amountDetails": {
            "billingAmount": "7",
            "currency": "USD",
            "setupFee": "0"
        }
    }
}
```

Response to a Successful Request

```
{
    "_links": {
        "self": {
            "href": "/rbs/v1/plans/1619212820",
            "method": "GET"
        },
        "update": {
            "href": "/rbs/v1/plans/1619212820",
            "method": "PATCH"
        },
        "deactivate": {
            "href": "/rbs/v1/plans/1619212820/deactivate",
            "method": "POST"
        }
    },
    "id": "1619212820",
    "status": "COMPLETED",
    "planInformation": {
        "code": "1619310018",
        "status": "ACTIVE"
    }
}
```

Error Response

```
{
   "status": "INVALID_REQUEST",
   "reason": "INVALID_DATA",
   "message": "One or more fields in the request contains invalid data.",
   "details": [
       {
          "field": "planInformation.code",
          "reason": "DUPLICATE"
       }
    ]
 }
```

RELATED TO THIS PAGE

