curl --request POST \
--url https://{defaultHost}/v1/prices/{id}/duplicate \
--header 'Authorization: Bearer <token>'import requests
url = "https://{defaultHost}/v1/prices/{id}/duplicate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{defaultHost}/v1/prices/{id}/duplicate', 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://{defaultHost}/v1/prices/{id}/duplicate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/prices/{id}/duplicate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/prices/{id}/duplicate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/prices/{id}/duplicate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "9589cf65-57a4-48ab-8cc0-4215fbb4911d",
"object": "price",
"ad_hoc": false,
"ad_hoc_max_amount": null,
"ad_hoc_min_amount": 0,
"amount": 2900,
"archived": false,
"archived_at": null,
"currency": "usd",
"current_version": true,
"full_amount": 2900,
"license_activation_limit": null,
"metadata": {},
"name": " (Duplicate)",
"position": 0,
"portal_subscription_update_enabled": true,
"proration_method": "unused_amount_paid",
"restart_subscription_on_completed": false,
"revoke_after_days": null,
"revoke_purchases_on_completed": false,
"recurring_interval": null,
"recurring_interval_count": null,
"recurring_period_count": null,
"scratch_amount": null,
"setup_fee_amount": 0,
"setup_fee_enabled": false,
"setup_fee_trial_enabled": true,
"setup_fee_name": null,
"trial_duration_days": null,
"current_swap": null,
"product": "16c0bcdd-2676-4a14-b401-42fb0c4e7c17",
"renewal_price": null,
"discarded_at": null,
"created_at": 1796063956,
"updated_at": 1796063956
}Duplicate
Duplicates a specific price.
curl --request POST \
--url https://{defaultHost}/v1/prices/{id}/duplicate \
--header 'Authorization: Bearer <token>'import requests
url = "https://{defaultHost}/v1/prices/{id}/duplicate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{defaultHost}/v1/prices/{id}/duplicate', 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://{defaultHost}/v1/prices/{id}/duplicate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/prices/{id}/duplicate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/prices/{id}/duplicate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/prices/{id}/duplicate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "9589cf65-57a4-48ab-8cc0-4215fbb4911d",
"object": "price",
"ad_hoc": false,
"ad_hoc_max_amount": null,
"ad_hoc_min_amount": 0,
"amount": 2900,
"archived": false,
"archived_at": null,
"currency": "usd",
"current_version": true,
"full_amount": 2900,
"license_activation_limit": null,
"metadata": {},
"name": " (Duplicate)",
"position": 0,
"portal_subscription_update_enabled": true,
"proration_method": "unused_amount_paid",
"restart_subscription_on_completed": false,
"revoke_after_days": null,
"revoke_purchases_on_completed": false,
"recurring_interval": null,
"recurring_interval_count": null,
"recurring_period_count": null,
"scratch_amount": null,
"setup_fee_amount": 0,
"setup_fee_enabled": false,
"setup_fee_trial_enabled": true,
"setup_fee_name": null,
"trial_duration_days": null,
"current_swap": null,
"product": "16c0bcdd-2676-4a14-b401-42fb0c4e7c17",
"renewal_price": null,
"discarded_at": null,
"created_at": 1796063956,
"updated_at": 1796063956
}Authorizations
Response
Success
How a subscription switching to this price is credited for the unused part of its current period. unused_amount_paid credits the unused part of what was paid for the previous period, unused_renewal_price credits the unused part of the previous plan's renewal price, price_difference credits the previous plan's full renewal price so only the price difference is charged, and none gives no credit. The two price-based methods never reduce the charge below zero (for fixed-payment prices, below the total of all payments).
unused_amount_paid, unused_renewal_price, price_difference, none The number of intervals (specified in the recurring_interval attribute) between subscription billings. For example, recurring_interval=month and recurring_interval_count=3 bills every 3 months. The total duration of a billing cycle is not allowed to exceed 1 year. Only applicable during creation.
The full amount to be charged across all periods, represented as a whole integer. For prices without a recurring_period_count defined this is the same as amount. For finite prices, this is equal to amount * recurring_period_count. For example, a price that has an amount of $25 and is set to recur over 4 periods, will have a full_amount of $100.
The current swap for this price.
Expandable – The associated swap ID.
Expandable – The associated product ID.
If present, subscriptions will be updated to this price when they renew.
Expandable – The associated price ID.
Was this page helpful?