Create a subscription service
curl --request POST \
--url https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"service_fee": 123,
"penalty_fee": 123,
"interval_length": 123,
"num_intervals": 123,
"is_active": true,
"merchant_address": "<string>",
"service_fee_policyid": "<string>",
"service_fee_assetname": "<string>",
"penalty_fee_policyid": "<string>",
"penalty_fee_assetname": "<string>"
}
'import requests
url = "https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService"
payload = {
"service_fee": 123,
"penalty_fee": 123,
"interval_length": 123,
"num_intervals": 123,
"is_active": True,
"merchant_address": "<string>",
"service_fee_policyid": "<string>",
"service_fee_assetname": "<string>",
"penalty_fee_policyid": "<string>",
"penalty_fee_assetname": "<string>"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_fee: 123,
penalty_fee: 123,
interval_length: 123,
num_intervals: 123,
is_active: true,
merchant_address: '<string>',
service_fee_policyid: '<string>',
service_fee_assetname: '<string>',
penalty_fee_policyid: '<string>',
penalty_fee_assetname: '<string>'
})
};
fetch('https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service_fee' => 123,
'penalty_fee' => 123,
'interval_length' => 123,
'num_intervals' => 123,
'is_active' => true,
'merchant_address' => '<string>',
'service_fee_policyid' => '<string>',
'service_fee_assetname' => '<string>',
'penalty_fee_policyid' => '<string>',
'penalty_fee_assetname' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService"
payload := strings.NewReader("{\n \"service_fee\": 123,\n \"penalty_fee\": 123,\n \"interval_length\": 123,\n \"num_intervals\": 123,\n \"is_active\": true,\n \"merchant_address\": \"<string>\",\n \"service_fee_policyid\": \"<string>\",\n \"service_fee_assetname\": \"<string>\",\n \"penalty_fee_policyid\": \"<string>\",\n \"penalty_fee_assetname\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"service_fee\": 123,\n \"penalty_fee\": 123,\n \"interval_length\": 123,\n \"num_intervals\": 123,\n \"is_active\": true,\n \"merchant_address\": \"<string>\",\n \"service_fee_policyid\": \"<string>\",\n \"service_fee_assetname\": \"<string>\",\n \"penalty_fee_policyid\": \"<string>\",\n \"penalty_fee_assetname\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_fee\": 123,\n \"penalty_fee\": 123,\n \"interval_length\": 123,\n \"num_intervals\": 123,\n \"is_active\": true,\n \"merchant_address\": \"<string>\",\n \"service_fee_policyid\": \"<string>\",\n \"service_fee_assetname\": \"<string>\",\n \"penalty_fee_policyid\": \"<string>\",\n \"penalty_fee_assetname\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cbor_hex": "<string>",
"tx_hash": "<string>"
}Subscription
Create a subscription service
Create a new subscription service contract on Cardano with customizable payment intervals and terms.
POST
/
contracts
/
subscription
/
createService
Create a subscription service
curl --request POST \
--url https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"service_fee": 123,
"penalty_fee": 123,
"interval_length": 123,
"num_intervals": 123,
"is_active": true,
"merchant_address": "<string>",
"service_fee_policyid": "<string>",
"service_fee_assetname": "<string>",
"penalty_fee_policyid": "<string>",
"penalty_fee_assetname": "<string>"
}
'import requests
url = "https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService"
payload = {
"service_fee": 123,
"penalty_fee": 123,
"interval_length": 123,
"num_intervals": 123,
"is_active": True,
"merchant_address": "<string>",
"service_fee_policyid": "<string>",
"service_fee_assetname": "<string>",
"penalty_fee_policyid": "<string>",
"penalty_fee_assetname": "<string>"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_fee: 123,
penalty_fee: 123,
interval_length: 123,
num_intervals: 123,
is_active: true,
merchant_address: '<string>',
service_fee_policyid: '<string>',
service_fee_assetname: '<string>',
penalty_fee_policyid: '<string>',
penalty_fee_assetname: '<string>'
})
};
fetch('https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service_fee' => 123,
'penalty_fee' => 123,
'interval_length' => 123,
'num_intervals' => 123,
'is_active' => true,
'merchant_address' => '<string>',
'service_fee_policyid' => '<string>',
'service_fee_assetname' => '<string>',
'penalty_fee_policyid' => '<string>',
'penalty_fee_assetname' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService"
payload := strings.NewReader("{\n \"service_fee\": 123,\n \"penalty_fee\": 123,\n \"interval_length\": 123,\n \"num_intervals\": 123,\n \"is_active\": true,\n \"merchant_address\": \"<string>\",\n \"service_fee_policyid\": \"<string>\",\n \"service_fee_assetname\": \"<string>\",\n \"penalty_fee_policyid\": \"<string>\",\n \"penalty_fee_assetname\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"service_fee\": 123,\n \"penalty_fee\": 123,\n \"interval_length\": 123,\n \"num_intervals\": 123,\n \"is_active\": true,\n \"merchant_address\": \"<string>\",\n \"service_fee_policyid\": \"<string>\",\n \"service_fee_assetname\": \"<string>\",\n \"penalty_fee_policyid\": \"<string>\",\n \"penalty_fee_assetname\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.gomaestro-api.org/v1/contracts/subscription/createService")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_fee\": 123,\n \"penalty_fee\": 123,\n \"interval_length\": 123,\n \"num_intervals\": 123,\n \"is_active\": true,\n \"merchant_address\": \"<string>\",\n \"service_fee_policyid\": \"<string>\",\n \"service_fee_assetname\": \"<string>\",\n \"penalty_fee_policyid\": \"<string>\",\n \"penalty_fee_assetname\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cbor_hex": "<string>",
"tx_hash": "<string>"
}Authorizations
Project API Key
Body
application/json
Service fee amount
Penalty fee amount
Length of the interval
Number of intervals
Is the service active
Merchant address
UTXO
Show child attributes
Show child attributes
Policy ID of the service fee
Asset name of the service fee
Policy ID of the penalty fee
Asset name of the penalty fee
Was this page helpful?
⌘I

