Skip to main content

CreateSubscriptionService

Creates a new subscription service with one or more plans. Each plan defines a pricing tier with a duration and amount.

Request

POST /nxt?requestType=createSubscriptionService

All endpoints use port 22024 by default.

Parameters

NameTypeDescriptionRequired
namestringService nameYes
descriptionstringService descriptionYes
holdingIdstringHolding ID for payment currencyYes
holdingTypebyteHolding type (0-3)Yes
plansstringJSON array of plan objectsYes
secretPhrasestringService owner's secret passphraseYes

Plan Object Format

Each plan in the plans array must contain:

FieldTypeDescription
planstringPlan name
descriptionstringPlan description
durationintDuration in days
amountQNTstringAmount in QNT
metadataobjectOptional key-value pairs

Response

{
"transaction": "1234567890123456789",
"fullHash": "abc123def456...",
"errorCode": 0,
"errorDescription": ""
}

Example

curl -X POST "http://localhost:22024/nxt?requestType=createSubscriptionService" \
-d "name=Premium Service" \
-d "description=Premium subscription" \
-d "holdingId=1234567890123456789" \
-d "holdingType=1" \
-d "plans=[{\"plan\":\"Basic\",\"description\":\"Basic plan\",\"duration\":30,\"amountQNT\":\"100000000\"},{\"plan\":\"Pro\",\"description\":\"Pro plan\",\"duration\":30,\"amountQNT\":\"500000000\"}]" \
-d "secretPhrase=your_secret_passphrase"