Update a price plan
curl --request PATCH \
--url https://api.togai.com/v2/price_plans/{price_plan_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"supportedCurrencies": [
"<string>"
]
}
'import requests
url = "https://api.togai.com/v2/price_plans/{price_plan_id}"
payload = {
"description": "<string>",
"supportedCurrencies": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: '<string>', supportedCurrencies: ['<string>']})
};
fetch('https://api.togai.com/v2/price_plans/{price_plan_id}', 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.togai.com/v2/price_plans/{price_plan_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'description' => '<string>',
'supportedCurrencies' => [
'<string>'
]
]),
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.togai.com/v2/price_plans/{price_plan_id}"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"supportedCurrencies\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/v2/price_plans/{price_plan_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"supportedCurrencies\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/v2/price_plans/{price_plan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"supportedCurrencies\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"type": "BILLING",
"supportedCurrencies": [
"<string>"
],
"id": "<string>",
"referenceId": "<string>",
"version": 123,
"status": "DRAFT",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"pricingCycleConfig": {
"interval": "WEEKLY",
"gracePeriod": 3,
"startOffset": {
"dayOffset": "<string>",
"monthOffset": "<string>"
},
"anniversaryCycle": true
},
"deferredRevenue": true,
"allowOngoingCycleUpdates": true
}Price Plan V2
Update a price plan
Update a price plan
PATCH
/
v2
/
price_plans
/
{price_plan_id}
Update a price plan
curl --request PATCH \
--url https://api.togai.com/v2/price_plans/{price_plan_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"supportedCurrencies": [
"<string>"
]
}
'import requests
url = "https://api.togai.com/v2/price_plans/{price_plan_id}"
payload = {
"description": "<string>",
"supportedCurrencies": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({description: '<string>', supportedCurrencies: ['<string>']})
};
fetch('https://api.togai.com/v2/price_plans/{price_plan_id}', 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.togai.com/v2/price_plans/{price_plan_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'description' => '<string>',
'supportedCurrencies' => [
'<string>'
]
]),
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.togai.com/v2/price_plans/{price_plan_id}"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"supportedCurrencies\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/v2/price_plans/{price_plan_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"supportedCurrencies\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/v2/price_plans/{price_plan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"<string>\",\n \"supportedCurrencies\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"type": "BILLING",
"supportedCurrencies": [
"<string>"
],
"id": "<string>",
"referenceId": "<string>",
"version": 123,
"status": "DRAFT",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>",
"pricingCycleConfig": {
"interval": "WEEKLY",
"gracePeriod": 3,
"startOffset": {
"dayOffset": "<string>",
"monthOffset": "<string>"
},
"anniversaryCycle": true
},
"deferredRevenue": true,
"allowOngoingCycleUpdates": true
}Authorizations
Body
application/json
Payload to update price plan
Response
Response for Create and Get price plan requests
Request to create a price plan
This option can be enabled while creating a price plan to opt for deferred revenue finalization. i.e, Togai will assume that the price plan may change any time during the pricing cycle and thereby does not compute the revenue in near-real time. This gives the flexibility of editing rate cards in price plan from beginning of the pricing cycle. Enabling this mode comes with the following limitations.
- Following rate cards are not supported under a
deferredRevenueplan- creditGrantRateCards,
- billingEntitlementRateCards,
- entitlementOverageRateCards,
- IN_ADVANCE fixedFeeRateCards,
- IN_ADVANCE licenseRateCards
- Metrics API return revenue metrics only after the grace period of the account's pricing cycle (i.e, only once the invoice becomes DUE)
