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"
       }
    ]
 }
```

