Node.js
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.subscriptions.savePlans({
items: [],
});<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->subscriptions->savePlans([
'items' => [],
]);
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.subscriptions.savePlans(items=[])
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/subscription-plans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"variantId": "<string>",
"every": 1
}
]
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/subscription-plans"
payload := strings.NewReader("{\n \"items\": [\n {\n \"variantId\": \"<string>\",\n \"every\": 1\n }\n ]\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.shoply.gg/v1/stores/{storeId}/subscription-plans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"variantId\": \"<string>\",\n \"every\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/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 \"items\": [\n {\n \"variantId\": \"<string>\",\n \"every\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": [
{
"variantId": "00e1d395-9ba2-4db3-900a-cb5e2811a2a9",
"productId": "f463e265-097a-4235-bc2f-5239b19a9874",
"productName": "Northwind Pro",
"variantName": "1 month",
"price": 9.99,
"every": 1,
"unit": "month",
"running": 0,
"automatic": 0
}
],
"meta": {
"settings": {
"cancelOn": true,
"cancelMode": "end",
"undoOn": true,
"pauseOn": true,
"pauseDays": 30,
"pausesAYear": 2,
"remindersOn": true,
"reminderDays": [
7,
3
],
"graceDays": 3,
"revokeOn": true,
"autoOn": true,
"cardChangeOn": true,
"chargeTries": 3
},
"limits": {
"maxPlans": 200,
"minDays": 7,
"maxDays": 365,
"maxReminders": 5,
"maxReminderDay": 30,
"maxGraceDays": 30,
"maxPauseDays": 365,
"maxPausesAYear": 12,
"maxChargeTries": 5
}
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Subscriptions
Sell options as subscriptions
Makes options subscriptions, or changes how often one renews. A change reaches new subscriptions only: a running one renews as it started. A store has up to 200 plans. The answer is every plan the store has.
Needs the subscriptions.write permission (Change Subscriptions).
POST
/
stores
/
{storeId}
/
subscription-plans
Node.js
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.subscriptions.savePlans({
items: [],
});<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->subscriptions->savePlans([
'items' => [],
]);
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.subscriptions.savePlans(items=[])
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/subscription-plans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"variantId": "<string>",
"every": 1
}
]
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/subscription-plans"
payload := strings.NewReader("{\n \"items\": [\n {\n \"variantId\": \"<string>\",\n \"every\": 1\n }\n ]\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.shoply.gg/v1/stores/{storeId}/subscription-plans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"variantId\": \"<string>\",\n \"every\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/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 \"items\": [\n {\n \"variantId\": \"<string>\",\n \"every\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": [
{
"variantId": "00e1d395-9ba2-4db3-900a-cb5e2811a2a9",
"productId": "f463e265-097a-4235-bc2f-5239b19a9874",
"productName": "Northwind Pro",
"variantName": "1 month",
"price": 9.99,
"every": 1,
"unit": "month",
"running": 0,
"automatic": 0
}
],
"meta": {
"settings": {
"cancelOn": true,
"cancelMode": "end",
"undoOn": true,
"pauseOn": true,
"pauseDays": 30,
"pausesAYear": 2,
"remindersOn": true,
"reminderDays": [
7,
3
],
"graceDays": 3,
"revokeOn": true,
"autoOn": true,
"cardChangeOn": true,
"chargeTries": 3
},
"limits": {
"maxPlans": 200,
"minDays": 7,
"maxDays": 365,
"maxReminders": 5,
"maxReminderDay": 30,
"maxGraceDays": 30,
"maxPauseDays": 365,
"maxPausesAYear": 12,
"maxChargeTries": 5
}
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Authorizations
A secret API key, made under Developers in the dashboard: Authorization: Bearer shoply_sk_...
Headers
A word of your own for this one change, up to 180 letters, digits, dots, dashes, underscores and colons. Sent again with the same key, the request is not carried out twice: the first answer comes back, with Idempotent-Replay: true.
Path Parameters
The store's ID. A key reaches the store it was made in: GET /key answers which.
Body
application/json
The options and how often each renews.
Show child attributes
Show child attributes

