curl --request POST \
--url https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"updates": [
{
"type": "add_product",
"payload": {
"product_id": "<string>",
"billing_interval_count": 123,
"type": "fee",
"product_name": "<string>",
"product_description": "<string>",
"count": 1,
"display_interval_dates_in_description": true,
"prices": [
{
"type": "fee",
"amount": 123
}
]
}
}
],
"apply_at": "2024-12-20T16:04:11Z",
"charge_at": "2024-12-20T16:04:11Z",
"precision": "calendar_days"
}
'import requests
url = "https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates"
payload = {
"updates": [
{
"type": "add_product",
"payload": {
"product_id": "<string>",
"billing_interval_count": 123,
"type": "fee",
"product_name": "<string>",
"product_description": "<string>",
"count": 1,
"display_interval_dates_in_description": True,
"prices": [
{
"type": "fee",
"amount": 123
}
]
}
}
],
"apply_at": "2024-12-20T16:04:11Z",
"charge_at": "2024-12-20T16:04:11Z",
"precision": "calendar_days"
}
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({
updates: [
{
type: 'add_product',
payload: {
product_id: '<string>',
billing_interval_count: 123,
type: 'fee',
product_name: '<string>',
product_description: '<string>',
count: 1,
display_interval_dates_in_description: true,
prices: [{type: 'fee', amount: 123}]
}
}
],
apply_at: '2024-12-20T16:04:11Z',
charge_at: '2024-12-20T16:04:11Z',
precision: 'calendar_days'
})
};
fetch('https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates', 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.hyperline.co/v1/subscriptions/{id}/simulate-updates",
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([
'updates' => [
[
'type' => 'add_product',
'payload' => [
'product_id' => '<string>',
'billing_interval_count' => 123,
'type' => 'fee',
'product_name' => '<string>',
'product_description' => '<string>',
'count' => 1,
'display_interval_dates_in_description' => true,
'prices' => [
[
'type' => 'fee',
'amount' => 123
]
]
]
]
],
'apply_at' => '2024-12-20T16:04:11Z',
'charge_at' => '2024-12-20T16:04:11Z',
'precision' => 'calendar_days'
]),
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.hyperline.co/v1/subscriptions/{id}/simulate-updates"
payload := strings.NewReader("{\n \"updates\": [\n {\n \"type\": \"add_product\",\n \"payload\": {\n \"product_id\": \"<string>\",\n \"billing_interval_count\": 123,\n \"type\": \"fee\",\n \"product_name\": \"<string>\",\n \"product_description\": \"<string>\",\n \"count\": 1,\n \"display_interval_dates_in_description\": true,\n \"prices\": [\n {\n \"type\": \"fee\",\n \"amount\": 123\n }\n ]\n }\n }\n ],\n \"apply_at\": \"2024-12-20T16:04:11Z\",\n \"charge_at\": \"2024-12-20T16:04:11Z\",\n \"precision\": \"calendar_days\"\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.hyperline.co/v1/subscriptions/{id}/simulate-updates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"updates\": [\n {\n \"type\": \"add_product\",\n \"payload\": {\n \"product_id\": \"<string>\",\n \"billing_interval_count\": 123,\n \"type\": \"fee\",\n \"product_name\": \"<string>\",\n \"product_description\": \"<string>\",\n \"count\": 1,\n \"display_interval_dates_in_description\": true,\n \"prices\": [\n {\n \"type\": \"fee\",\n \"amount\": 123\n }\n ]\n }\n }\n ],\n \"apply_at\": \"2024-12-20T16:04:11Z\",\n \"charge_at\": \"2024-12-20T16:04:11Z\",\n \"precision\": \"calendar_days\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates")
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 \"updates\": [\n {\n \"type\": \"add_product\",\n \"payload\": {\n \"product_id\": \"<string>\",\n \"billing_interval_count\": 123,\n \"type\": \"fee\",\n \"product_name\": \"<string>\",\n \"product_description\": \"<string>\",\n \"count\": 1,\n \"display_interval_dates_in_description\": true,\n \"prices\": [\n {\n \"type\": \"fee\",\n \"amount\": 123\n }\n ]\n }\n }\n ],\n \"apply_at\": \"2024-12-20T16:04:11Z\",\n \"charge_at\": \"2024-12-20T16:04:11Z\",\n \"precision\": \"calendar_days\"\n}"
response = http.request(request)
puts response.read_body{
"amount": 123
}{
"message": "<string>"
}Simulate subscription updates
Simulate the effect of updates on a subscription without actually applying them.
curl --request POST \
--url https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"updates": [
{
"type": "add_product",
"payload": {
"product_id": "<string>",
"billing_interval_count": 123,
"type": "fee",
"product_name": "<string>",
"product_description": "<string>",
"count": 1,
"display_interval_dates_in_description": true,
"prices": [
{
"type": "fee",
"amount": 123
}
]
}
}
],
"apply_at": "2024-12-20T16:04:11Z",
"charge_at": "2024-12-20T16:04:11Z",
"precision": "calendar_days"
}
'import requests
url = "https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates"
payload = {
"updates": [
{
"type": "add_product",
"payload": {
"product_id": "<string>",
"billing_interval_count": 123,
"type": "fee",
"product_name": "<string>",
"product_description": "<string>",
"count": 1,
"display_interval_dates_in_description": True,
"prices": [
{
"type": "fee",
"amount": 123
}
]
}
}
],
"apply_at": "2024-12-20T16:04:11Z",
"charge_at": "2024-12-20T16:04:11Z",
"precision": "calendar_days"
}
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({
updates: [
{
type: 'add_product',
payload: {
product_id: '<string>',
billing_interval_count: 123,
type: 'fee',
product_name: '<string>',
product_description: '<string>',
count: 1,
display_interval_dates_in_description: true,
prices: [{type: 'fee', amount: 123}]
}
}
],
apply_at: '2024-12-20T16:04:11Z',
charge_at: '2024-12-20T16:04:11Z',
precision: 'calendar_days'
})
};
fetch('https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates', 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.hyperline.co/v1/subscriptions/{id}/simulate-updates",
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([
'updates' => [
[
'type' => 'add_product',
'payload' => [
'product_id' => '<string>',
'billing_interval_count' => 123,
'type' => 'fee',
'product_name' => '<string>',
'product_description' => '<string>',
'count' => 1,
'display_interval_dates_in_description' => true,
'prices' => [
[
'type' => 'fee',
'amount' => 123
]
]
]
]
],
'apply_at' => '2024-12-20T16:04:11Z',
'charge_at' => '2024-12-20T16:04:11Z',
'precision' => 'calendar_days'
]),
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.hyperline.co/v1/subscriptions/{id}/simulate-updates"
payload := strings.NewReader("{\n \"updates\": [\n {\n \"type\": \"add_product\",\n \"payload\": {\n \"product_id\": \"<string>\",\n \"billing_interval_count\": 123,\n \"type\": \"fee\",\n \"product_name\": \"<string>\",\n \"product_description\": \"<string>\",\n \"count\": 1,\n \"display_interval_dates_in_description\": true,\n \"prices\": [\n {\n \"type\": \"fee\",\n \"amount\": 123\n }\n ]\n }\n }\n ],\n \"apply_at\": \"2024-12-20T16:04:11Z\",\n \"charge_at\": \"2024-12-20T16:04:11Z\",\n \"precision\": \"calendar_days\"\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.hyperline.co/v1/subscriptions/{id}/simulate-updates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"updates\": [\n {\n \"type\": \"add_product\",\n \"payload\": {\n \"product_id\": \"<string>\",\n \"billing_interval_count\": 123,\n \"type\": \"fee\",\n \"product_name\": \"<string>\",\n \"product_description\": \"<string>\",\n \"count\": 1,\n \"display_interval_dates_in_description\": true,\n \"prices\": [\n {\n \"type\": \"fee\",\n \"amount\": 123\n }\n ]\n }\n }\n ],\n \"apply_at\": \"2024-12-20T16:04:11Z\",\n \"charge_at\": \"2024-12-20T16:04:11Z\",\n \"precision\": \"calendar_days\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperline.co/v1/subscriptions/{id}/simulate-updates")
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 \"updates\": [\n {\n \"type\": \"add_product\",\n \"payload\": {\n \"product_id\": \"<string>\",\n \"billing_interval_count\": 123,\n \"type\": \"fee\",\n \"product_name\": \"<string>\",\n \"product_description\": \"<string>\",\n \"count\": 1,\n \"display_interval_dates_in_description\": true,\n \"prices\": [\n {\n \"type\": \"fee\",\n \"amount\": 123\n }\n ]\n }\n }\n ],\n \"apply_at\": \"2024-12-20T16:04:11Z\",\n \"charge_at\": \"2024-12-20T16:04:11Z\",\n \"precision\": \"calendar_days\"\n}"
response = http.request(request)
puts response.read_body{
"amount": 123
}{
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
immediately, scheduled immediately, next_invoice, custom pro_rata, pay_in_full, do_not_charge Add a new product to bill as part of the subscription.
- Add product
- Remove product
- Add coupon
- Remove coupon
- Update count
- Update prices
Show child attributes
Show child attributes
The date when the update should be applied. Required when application_schedule is 'scheduled'.
"2024-12-20T16:04:11Z"
The date when the resulting subscription update should be charged. Required when payment_schedule is 'custom'. Must be in the future.
"2024-12-20T16:04:11Z"
Granularity used to prorate the update amount. Defaults to 'calendar_days' when omitted, prorating on whole calendar days; 'milliseconds' prorates on the exact elapsed time, charging the precise partial period.
calendar_days, milliseconds "calendar_days"
Override the refund destination when the update generates a refund credit note (e.g. seat reduction). When omitted, falls back to the invoicing entity's creditNoteWalletRefundEnabled setting.
wallet, original_payment_method, external Response
Simulation results
Was this page helpful?

