v1

latestOpenAPI 3.0.02026-07-246335313.6 KB
Plan APIs

Create Plan

Use this API for Creating Plan.

post/api/subscription/createPlan

Headers

Content-Typestring
X-Portone-Client-Keystring

The PortOne Key of the merchant

Authorizationstring

The Authorization header is used to include the JWT for authenticating API requests; learn how to generate the token <a href="/docs/jwt-authentication" target="_blank">in this guide</a>

Request body

portone_keystring required

The unique PortOne key for merchant

signature_hashstring required

The signature_hash of plan generated as per <a href="/docs/regular-plan" target="_blank">Regular Plan Request Signature Documentation</a> or <a href="/docs/ondemand-plan" target="_blank">Ondemand Plan Request Signature Documentation</a>

merchant_order_refstring required

The unique merchant order reference generated by the merchant

source'default' | 'api' | 'checkout' required

default, api or checkout -- The Source of Plan creation.

descriptionstring

The description of the plan

environment'live' | 'sandbox' required

The environment of plan. Either live OR sandbox

namestring required

The name of the plan

currencystring required

The currency of the plan

plan_type'REGULAR' | 'ONDEMAND' required

The type of plan

amountnumber double

The amount of the plan, can be a floating-point number. Required only for REGULAR Plan, not available for ONDEMAND Plan

frequencyinteger

The frequency of the plan (must be greater than 0). Required only for REGULAR Plan, not available for ONDEMAND Plan

period'H' | 'D' | 'W' | 'M' | 'Q' | 'Y'

The period of the plan. Required only for REGULAR Plan, not available for ONDEMAND Plan. Hour period is only for testing purpose.

Example request

{
  "portone_key": "<PortoneKey>",
  "signature_hash": "<Genrated signature_hash>",
  "merchant_order_ref": "<Unique merchant_order_ref>",
  "source": "api",
  "amount": 100,
  "currency": "THB",
  "description": "Testing",
  "environment": "sandbox",
  "frequency": 1,
  "period": "M",
  "name": "100 THB Monthly",
  "plan_type": "REGULAR"
}

Response

Successful response

merchant_order_refstring

The unique Order reference generated by merchant

order_refstring

The unique Order reference generated by PortOne

status_codestring

The status_code for API request execution result