---
url: "https://docs.portone.cloud/docs/creating-an-on-demand-plan"
title: "Creating an OnDemand Plan"
---
This document provides a comprehensive guide for creating an **On-Demand Plan** using the PortOne API. An On-Demand Plan allows merchants to charge customers based on their usage or activity without fixed intervals.
🦉
Subscription: Creating an OnDemand Plan
Open Recipe
* * *
## **API Endpoint** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#api-endpoint)
**POST** `https://api.portone.cloud/api/subscription/createPlan`
* * *
## **Headers** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#headers)
##### `Content-Type` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#content-type)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan)
Set to `application/json`.
* * *
##### `X-Portone-Client-Key` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#x-portone-client-key)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-1)
The unique PortOne key for the merchant.
* * *
##### `Authorization` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#authorization)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-2)
JWT for authenticating API requests. Learn how to generate the token [here](https://docs.portone.cloud/docs/jwt-authentication).
* * *
## **Request Example** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#request-example)
#### Request Body: [Skip link to Request Body:](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#request-body)
JSON
```rdmd-code lang-json theme-light
{
"portone_key": "PORTONE_KEY",
"merchant_order_ref": "Plan_1729672233766",
"source": "api",
"currency": "USD",
"name": "OnDemand USD plan",
"description": "OnDemand USD plan",
"environment": "sandbox",
"plan_type": "ONDEMAND",
"notes": [\
{ "key": "key1", "value": "value1" },\
{ "key": "key2", "value": "value2" }\
]
}
```
## **Request Body Parameters** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#request-body-parameters)
Below are the required and optional parameters for creating an **On-Demand Plan**:
### **General Parameters** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#general-parameters)
##### `portone_key` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#portone_key)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-3)
The unique PortOne key for the merchant.
* * *
##### `signature_hash` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#signature_hash)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-4)
Signature hash generated as per [On-Demand Plan Request Signature Documentation](https://docs.portone.cloud/docs/ondemand-plan).
* * *
##### `merchant_order_ref` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#merchant_order_ref)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-5)
The unique merchant order reference generated by the merchant.
* * *
##### `source` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#source)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-6)
The source of plan creation: `default`, `api`, or `checkout`.
* * *
##### `description` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#description)
###### _string_ [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string)
A description of the plan.
* * *
##### `environment` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#environment)
###### _string · required_ [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-7)
Plan environment, either `live` or `sandbox`.
* * *
##### `name` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#name)
###### _string · required_ [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-8)
Name of the plan.
* * *
##### notes [Skip link to notes](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#notes)
###### _array of objects_ [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#array-of-objects)
The JSON array for additional notes
> ##### key [Skip link to key](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#key)
>
> ###### _string_ · The key describing the note. Example: `special_instructions` or `gift_wrap`. [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-the-key-describing-the-note-example-special_instructions-or-gift_wrap)
>
> ##### value [Skip link to value](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#value)
>
> ###### _string_ · The value of the note. Example: `Deliver between 9-11 AM` or `Yes`. [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-the-value-of-the-note-example-deliver-between-9-11-am-or-yes)
* * *
### **On-Demand Plan-Specific Parameters** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#on-demand-plan-specific-parameters)
##### `currency` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#currency)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-9)
Currency of the plan (e.g., `USD`).
* * *
##### `plan_type` [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#plan_type)
###### _string_ · required [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#string-%C2%B7-span-stylecolorredrequiredspan-10)
Type of plan. Set to `ONDEMAND`.
* * *
## **Response** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#response)
#### **Success Response** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#success-response)
JSON
```rdmd-code lang-json theme-light
{
"is_success": true,
"merchant_order_ref": "Subscription_1729672233761",
"order_ref": "2nsJNracNOB6mzJ4elECMmnOlu2",
"subscription_link": "https://subscription.portone.cloud/?ref=2nsJNracNOB6mzJ4elECMmnOlu2",
"status_code": "200"
}
```
#### **Error Response** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#error-response)
JSON
```rdmd-code lang-json theme-light
{
"is_success": false,
"message": "The API request failed due to invalid parameters.",
"status_code": "400",
"status_reason": "Bad Request"
}
```
* * *
## **Best Practices** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#best-practices)
- **Environment Selection**: Use `sandbox` for testing and `live` for production.
- **Validation**: Ensure all required fields are correctly validated before sending the request.
- **Testing**: Test your API integration in the sandbox environment before moving to production.
* * *
## **Key Notes** [Skip link to [object Object]](https://docs.portone.cloud/docs/creating-an-on-demand-plan\#key-notes)
- **OnDemand Plans**: Ideal for usage-based subscriptions or services with variable billing.
- **Descriptive Details**: Use descriptive names and notes for easier plan management and tracking.
* * *
This document serves as a comprehensive guide to creating **OnDemand Plans** with the PortOne API.