Skip to main content
POST
/
v0
/
prices
Create
curl --request POST \
  --url https://api.paygentic.io/v0/prices \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "invoiceDisplayName": "<string>",
  "properties": {
    "unitPrice": "<string>"
  },
  "billableMetricId": "<string>",
  "feeId": "<string>",
  "pricingUnitId": "<string>",
  "model": "standard",
  "billingCadence": "<string>",
  "grantDiscountEnabled": false,
  "quantity": 1
}
'
import requests

url = "https://api.paygentic.io/v0/prices"

payload = {
    "invoiceDisplayName": "<string>",
    "properties": { "unitPrice": "<string>" },
    "billableMetricId": "<string>",
    "feeId": "<string>",
    "pricingUnitId": "<string>",
    "model": "standard",
    "billingCadence": "<string>",
    "grantDiscountEnabled": False,
    "quantity": 1
}
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({
    invoiceDisplayName: '<string>',
    properties: {unitPrice: '<string>'},
    billableMetricId: '<string>',
    feeId: '<string>',
    pricingUnitId: '<string>',
    model: 'standard',
    billingCadence: '<string>',
    grantDiscountEnabled: false,
    quantity: 1
  })
};

fetch('https://api.paygentic.io/v0/prices', 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.paygentic.io/v0/prices",
  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([
    'invoiceDisplayName' => '<string>',
    'properties' => [
        'unitPrice' => '<string>'
    ],
    'billableMetricId' => '<string>',
    'feeId' => '<string>',
    'pricingUnitId' => '<string>',
    'model' => 'standard',
    'billingCadence' => '<string>',
    'grantDiscountEnabled' => false,
    'quantity' => 1
  ]),
  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.paygentic.io/v0/prices"

	payload := strings.NewReader("{\n  \"invoiceDisplayName\": \"<string>\",\n  \"properties\": {\n    \"unitPrice\": \"<string>\"\n  },\n  \"billableMetricId\": \"<string>\",\n  \"feeId\": \"<string>\",\n  \"pricingUnitId\": \"<string>\",\n  \"model\": \"standard\",\n  \"billingCadence\": \"<string>\",\n  \"grantDiscountEnabled\": false,\n  \"quantity\": 1\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.paygentic.io/v0/prices")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"invoiceDisplayName\": \"<string>\",\n  \"properties\": {\n    \"unitPrice\": \"<string>\"\n  },\n  \"billableMetricId\": \"<string>\",\n  \"feeId\": \"<string>\",\n  \"pricingUnitId\": \"<string>\",\n  \"model\": \"standard\",\n  \"billingCadence\": \"<string>\",\n  \"grantDiscountEnabled\": false,\n  \"quantity\": 1\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.paygentic.io/v0/prices")

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  \"invoiceDisplayName\": \"<string>\",\n  \"properties\": {\n    \"unitPrice\": \"<string>\"\n  },\n  \"billableMetricId\": \"<string>\",\n  \"feeId\": \"<string>\",\n  \"pricingUnitId\": \"<string>\",\n  \"model\": \"standard\",\n  \"billingCadence\": \"<string>\",\n  \"grantDiscountEnabled\": false,\n  \"quantity\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "id": "price_l5m6n7o8p9q0r1s2",
  "object": "price",
  "billableMetricId": "bm_t3u4v5w6x7y8z9a0",
  "createdAt": "2024-01-18T11:20:00Z",
  "currency": "USD",
  "description": "Per-token pricing for Claude API",
  "invoiceDisplayName": "Claude Token Consumption",
  "model": "standard",
  "paymentTerm": "instant",
  "properties": {
    "unitPrice": "0.00002"
  },
  "unitAmount": "20000000",
  "updatedAt": "2024-01-18T11:20:00Z"
}
{
  "message": "The requested resource was not found",
  "error": "not_found"
}
{
  "message": "The requested resource was not found",
  "error": "not_found"
}
{
  "message": "The requested resource was not found",
  "error": "not_found"
}
{
  "message": "The requested resource was not found",
  "error": "not_found"
}
{
  "message": "The requested resource was not found",
  "error": "not_found"
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json
invoiceDisplayName
string
required

Line item label shown on customer invoices. Sample values: 'Claude Token Consumption', 'Storage Usage (GB)', 'Inference API Calls', 'Image Generation Count', 'Training Compute Hours', 'Data Transfer (TB)'

paymentTerm
enum<string>
required

Billing timing preference. For billable metrics: 'instant' (charges immediately) or 'in_arrears' (charges at period end). For fees: 'in_advance' (charges upfront) or 'in_arrears' (charges at period end).

Available options:
instant,
in_arrears,
in_advance
properties
object
required

Standard pricing model

billableMetricId
string

The unique identifier for the billable metric referred to by this price. Either billableMetricId or feeId must be provided.

Pattern: ^bm_[a-zA-Z0-9]+$
feeId
string

The unique identifier for the fee referred to by this price. Either billableMetricId or feeId must be provided.

Pattern: ^fee_[a-zA-Z0-9]+$
pricingUnitId
string

Denominate this metered price in a pricing unit (credits) instead of real currency. When set, the price draws down the customer's credit pool for that unit. Only valid on metered prices that carry a metered feature. Omit for a normal currency price.

Pattern: ^pu_[a-zA-Z0-9]+$
model
enum<string>

Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard'). Only 'standard' is accepted; for percentage/revenue-share use 'standard' with a unit-price multiplier. Legacy prices using 'dynamic'/'volume'/'percentage' stay readable and billable but cannot be created.

Available options:
standard
billingCadence
string | null

ISO 8601 duration for recurring charges (e.g., 'P1M' for monthly, 'P1Y' for yearly) or 'P0D' for one-time charges. Required for fees, optional for billable metrics. Sample values: 'P0D' for one-time, 'P1M' for monthly recurring, 'P1Y' for yearly recurring

feature
object

Optional feature to associate with this price

grantDiscountEnabled
boolean
default:false

When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.

quantity
integer
default:1

Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.

Required range: x >= 0

Response

Price created successfully

id
string
required

Unique identifier for a price

Pattern: ^price_[a-zA-Z0-9]+$
object
enum<string>
default:price
required
Available options:
price
merchantId
string
required

The merchant organization that owns this price, derived from the associated fee or billable metric. Present on single-price reads.

Pattern: ^org_[a-zA-Z0-9]+$
createdAt
string<date-time>
required
invoiceDisplayName
string
required
paymentTerm
enum<string>
required
Available options:
instant,
in_arrears,
in_advance
properties
object
required

Standard pricing model

updatedAt
string<date-time>
required
quantity
integer
required

Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.

Required range: x >= 0
billableMetricId
string

Unique identifier for a billable metric

Pattern: ^bm_[a-zA-Z0-9]+$
feeId
string

The unique identifier for the fee referred to by this price. Present when price is linked to a fee.

Pattern: ^fee_[a-zA-Z0-9]+$
pricingUnitId
string

The pricing unit this price is denominated in (credits). Present when the price draws down a credit pool instead of charging real currency.

Pattern: ^pu_[a-zA-Z0-9]+$
billingCadence
string | null

ISO 8601 duration. 'P0D' for one-time, 'P1M' for monthly, 'P1Y' for yearly. Required for fees, optional for billable metrics. Defaults to plan's billingCadence if not specified.

model
enum<string>

Pricing model of a price as returned by the API. Includes legacy models ('dynamic', 'volume', 'percentage') retained for existing prices; only 'standard' can be created (see PriceModelInput).

Available options:
standard,
dynamic,
volume,
percentage
features
object[]

Features associated with this price

grantDiscountEnabled
boolean
default:false

When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.