Create a subscription
The method allows you to connect a subscription
Header parameters
x-api-public-keystringOptional
Public API-key
x-api-signaturestringOptional
Signing the request body with a private API-key
Content-typestringOptionalExample:
Request content type
application/json
Body
Subscription request body
merchantIdstringRequiredExample:
Merchant ID in the system
feb6b8db-87f2-46cf-a2a7-74f4c71ec577
billingLinkIdstringRequiredExample:
Payment link identifier (coins will be debited from the linked address)
78c1d432-1c30-46c3-9a39-1d0eca9126bb
titlestringRequiredExample:
Subscription name
Premium
descriptionstringOptionalExample:
Subscription Description
Premium subscription. With premium subscription u can use premium functions
spendIntervalintegerRequiredExample:
Write-off period in minutes. For convenience, you can specify: -1 - daily write-off; -2 - weekly write-off; -3 - monthly write-off;
-1
currencystringRequiredExample:
Payment currency. You can specify a fiat currency or any other, the amount will be automatically converted to the currency of the payment link
USD
amountstringRequiredExample:
Payment amount in the specified currency
7.99
webhookUrlstringOptionalExample:
Subscription charge notification URL
https://merchant.domain/webhooks/subscription
Responses
200Success
application/json
post
POST /api-gateway/recurrents/create-subscription HTTP/1.1
Host: ocp.onchainpay.io
Content-Type: application/json
Accept: */*
Content-Length: 333
{
"merchantId": "feb6b8db-87f2-46cf-a2a7-74f4c71ec577",
"billingLinkId": "78c1d432-1c30-46c3-9a39-1d0eca9126bb",
"title": "Premium",
"description": "Premium subscription. With premium subscription u can use premium functions",
"spendInterval": "-1",
"currency": "USD",
"amount": "7.99",
"webhookUrl": "https://merchant.domain/webhooks/subscription"
}
200Success
{
"success": true,
"response": {
"id": "5aa99412-0ac3-4c90-a3b8-c46f6599eabb",
"merchantId": "feb6b8db-87f2-46cf-a2a7-74f4c71ec577",
"billingLinkId": "78c1d432-1c30-46c3-9a39-1d0eca9126bb",
"title": "Premium",
"description": "Premium subscription. With premium subscription u can use premium functions",
"spendInterval": "-1",
"status": "PENDING",
"message": null,
"currency": "USD",
"amount": "7.99",
"webhookUrl": "https://merchant.domain/webhooks/subscription",
"createdAt": "2025-07-15T10:50:46.085Z",
"updatedAt": "2025-07-15T10:50:46.085Z"
}
}
Last updated