Skip to main content
POST
/
v1
/
stores
/
{store}
/
subscription-plans
Create subscription plan
curl --request POST \
  --url https://api.confiopagos.com/v1/stores/{store}/subscription-plans \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "displayName": "Premium Monthly Plan",
  "amountCents": 50000,
  "description": "Access to all premium features with monthly billing",
  "currencyCode": "COP",
  "billingCycleFrequency": "MONTHLY",
  "billingCycleInterval": 1,
  "trialPeriodDays": 7
}
'
import requests

url = "https://api.confiopagos.com/v1/stores/{store}/subscription-plans"

payload = {
"displayName": "Premium Monthly Plan",
"amountCents": 50000,
"description": "Access to all premium features with monthly billing",
"currencyCode": "COP",
"billingCycleFrequency": "MONTHLY",
"billingCycleInterval": 1,
"trialPeriodDays": 7
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
displayName: 'Premium Monthly Plan',
amountCents: 50000,
description: 'Access to all premium features with monthly billing',
currencyCode: 'COP',
billingCycleFrequency: 'MONTHLY',
billingCycleInterval: 1,
trialPeriodDays: 7
})
};

fetch('https://api.confiopagos.com/v1/stores/{store}/subscription-plans', 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://api.confiopagos.com/v1/stores/{store}/subscription-plans",
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([
'displayName' => 'Premium Monthly Plan',
'amountCents' => 50000,
'description' => 'Access to all premium features with monthly billing',
'currencyCode' => 'COP',
'billingCycleFrequency' => 'MONTHLY',
'billingCycleInterval' => 1,
'trialPeriodDays' => 7
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$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://api.confiopagos.com/v1/stores/{store}/subscription-plans"

payload := strings.NewReader("{\n \"displayName\": \"Premium Monthly Plan\",\n \"amountCents\": 50000,\n \"description\": \"Access to all premium features with monthly billing\",\n \"currencyCode\": \"COP\",\n \"billingCycleFrequency\": \"MONTHLY\",\n \"billingCycleInterval\": 1,\n \"trialPeriodDays\": 7\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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://api.confiopagos.com/v1/stores/{store}/subscription-plans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"displayName\": \"Premium Monthly Plan\",\n \"amountCents\": 50000,\n \"description\": \"Access to all premium features with monthly billing\",\n \"currencyCode\": \"COP\",\n \"billingCycleFrequency\": \"MONTHLY\",\n \"billingCycleInterval\": 1,\n \"trialPeriodDays\": 7\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.confiopagos.com/v1/stores/{store}/subscription-plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"displayName\": \"Premium Monthly Plan\",\n \"amountCents\": 50000,\n \"description\": \"Access to all premium features with monthly billing\",\n \"currencyCode\": \"COP\",\n \"billingCycleFrequency\": \"MONTHLY\",\n \"billingCycleInterval\": 1,\n \"trialPeriodDays\": 7\n}"

response = http.request(request)
puts response.read_body
{
  "name": "stores/01JNRRDZDPH40DB2YRW329BFXM/subscription-plans/01JNRVWWHH68E76V3TMFFT6GHJ",
  "displayName": "Premium Monthly Plan",
  "amountCents": 50000,
  "currencyCode": "COP",
  "billingCycleFrequency": "MONTHLY",
  "billingCycleInterval": 1,
  "trialPeriodDays": 7,
  "status": "ACTIVE",
  "createTime": "2024-01-15T10:30:00Z",
  "updateTime": "2024-01-15T10:30:00Z",
  "description": "Access to all premium features"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

store
string
required
Example:

"01G65Z755AFWAKHE12NY0CQ9FH"

Body

application/json
displayName
string
required

Display name for the subscription plan

Required string length: 1 - 100
Example:

"Premium Monthly Plan"

amountCents
number
required

Subscription amount in cents

Example:

50000

description
string

Detailed description of the plan

Example:

"Access to all premium features with monthly billing"

currencyCode
string
default:COP

Currency code

Example:

"COP"

billingCycleFrequency
enum<string>
default:MONTHLY

Billing cycle frequency

Available options:
MONTHLY,
WEEKLY
Example:

"MONTHLY"

billingCycleInterval
number
default:1

Billing cycle interval (e.g., 1 = every month, 3 = every 3 months)

Required range: 1 <= x <= 12
Example:

1

trialPeriodDays
number
default:0

Trial period in days (0 = no trial)

Required range: 0 <= x <= 365
Example:

7

Response

200 - application/json

Successfully created subscription plan.

name
string
required

Subscription plan's resource name

Example:

"stores/01JNRRDZDPH40DB2YRW329BFXM/subscription-plans/01JNRVWWHH68E76V3TMFFT6GHJ"

displayName
string
required

Display name of the plan

Example:

"Premium Monthly Plan"

amountCents
number
required

Amount in cents

Example:

50000

currencyCode
string
required

Currency code

Example:

"COP"

billingCycleFrequency
enum<string>
required

Billing cycle frequency

Available options:
BILLING_FREQUENCY_UNSPECIFIED,
MONTHLY,
WEEKLY
Example:

"MONTHLY"

billingCycleInterval
number
required

Billing cycle interval

Example:

1

trialPeriodDays
number
required

Trial period in days

Example:

7

status
enum<string>
required

Plan status

Available options:
STATUS_UNSPECIFIED,
ACTIVE,
INACTIVE,
ARCHIVED
Example:

"ACTIVE"

createTime
string
required

Creation timestamp

Example:

"2024-01-15T10:30:00Z"

updateTime
string
required

Last update timestamp

Example:

"2024-01-15T10:30:00Z"

description
string

Plan description

Example:

"Access to all premium features"