Get the effective price for a product
/v1/organization/billing/prices/resolve// Use a delegated user OAuth token with org:billing:read in its issuing region.
const bird = new BirdClient({ apiKey: process.env.BIRD_OAUTH_ACCESS_TOKEN!, region: "eu1" });
await bird.billingPrices.resolve({ product_slug: "sms_sender_registration", dimensions: {country_code: "NL", sender_type: "alphanumeric"} });import os
# Use a delegated user OAuth token with org:billing:read in its issuing region.
client = Bird(api_key=os.environ["BIRD_OAUTH_ACCESS_TOKEN"], region="eu1")
client.billing_prices.resolve(product_slug="sms_sender_registration", dimensions={"country_code": "NL", "sender_type": "alphanumeric"})// Use a delegated user OAuth token with org:billing:read in its issuing region.
client, err := bird.NewClient(option.WithAPIKey(os.Getenv("BIRD_OAUTH_ACCESS_TOKEN")), option.WithRegion("eu1"))
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
result, err := client.BillingPrices.Resolve(ctx, bird.BillingPricesResolveParams{ProductSlug: "sms_sender_registration", Dimensions: map[string]string{"country_code": "NL", "sender_type": "alphanumeric"}})
if err != nil {
log.Fatal(err)
}
fmt.Println(result)// Use a delegated user OAuth token with org:billing:read in its issuing region.
$bird = new Bird(getenv('BIRD_OAUTH_ACCESS_TOKEN') ?: '', region: 'eu1');
$bird->billingPrices->resolve(['product_slug' => 'sms_sender_registration', 'dimensions' => ['country_code' => 'NL', 'sender_type' => 'alphanumeric']]);curl -X GET "https://us1.platform.bird.com/v1/organization/billing/prices/resolve" \
-H "Authorization: Bearer $TOKEN"{
"unit_price": {
"amount": "0.00995",
"currency_code": "USD"
},
"tax_rate": "0.21",
"tax_amount": {
"amount": "0.00995",
"currency_code": "USD"
},
"gross_price": {
"amount": "0.00995",
"currency_code": "USD"
},
"billing_unit_size": 1000,
"increment": "60/60",
"dimensions": {
"country_code": "US"
},
"name": "10DLC Brand Registration",
"pricing_model": "rate_card",
"billing_interval": "month",
"billing_interval_count": 1,
"pricing_interval": {
"unit": "month",
"count": 3
},
"intervals_per_charge": 1
}
Returns the effective unit price, tax, and gross price for a product after organization- and plan-specific pricing. Provide exactly one of product_id or product_slug. You can also provide pricing dimensions and a currency. Pass plan_id to price under a published self-serve plan in place of your current plan; organization-specific rates still take precedence. The currency defaults to the organization's billing currency; if necessary, the price is converted from the product's base currency. Requires a delegated user OAuth token with org:billing:read; workspace and organization master API keys are refused with 403.
Queryparameters
product_idstringProduct ID to price. Provide exactly one of product_id or product_slug.
product_slugstringProduct slug to price. Provide exactly one of product_id or product_slug.
plan_idstringPublished self-serve plan to price under in place of your current plan. Returns 404 if the plan is not an active self-serve plan.
dimensionsobjectKey-value pairs that refine attribute-based pricing, such as destination country or sender type. For example, dimensions[country_code]=US.
currencystringThree-letter ISO currency code. Defaults to your organization's billing currency.
Response Payload
tax_rateThe tax rate applied to this price for your organization, as a decimal (for example 0.21 for 21%). 0 if your organization is tax-exempt or no tax applies.
tax_amountThe tax charged on one unit, computed from unit_price and tax_rate.
gross_priceThe total your organization is charged per unit, that is, unit_price plus tax_amount.
billing_unit_sizeNumber of units that form one chargeable block. Overage usage is ceiling-rounded to the nearest multiple of this value before the unit price is applied. A value of 1 charges per individual unit.
incrementThe billing rounding window for time-based products, expressed as {initial_seconds}/{continuation_seconds}. For example, 60/60 means each unit covers 60 seconds. null for per-unit products.
dimensionsPricing dimensions that determined this price (for example, country_code, sender_type).
nameDisplay name of the product this price was resolved for.
external_descriptionCustomer-facing description of the product this price was resolved for, when set.
pricing_modelHow this product is priced.
plan: it comes with the organization's subscribed plan, with usage tracked against that plan's included allowance.metered: it is billed per unit beyond any included allowance.rate_card: the per-unit price varies by attributes of the usage, such as destination, instead of being flat.unit_subscription: it is a standalone add-on billed as its own recurring subscription, independent of the plan.custom: a pricing arrangement that does not fit the other models.counter: usage is recorded without enforcing a spending cap or blocking requests.
Possible values: plan, metered, rate_card, unit_subscription, custom, counter
billing_intervalCompatibility alias for pricing_interval.unit. Only present when pricing_model is unit_subscription, or plan with configured recurring terms. Omitted for other pricing models and plans without configured terms.
Possible values: day, month, year
billing_interval_countCompatibility alias for intervals_per_charge. Only present when pricing_model is unit_subscription, or plan with configured recurring terms. Omitted for other pricing models and plans without configured terms.
pricing_intervalPeriod covered by the resolved recurring rate. Present for unit_subscription products and plans with configured recurring terms. Omitted for other pricing models and plans without configured terms.
intervals_per_chargeNumber of complete pricing intervals bought by each recurring charge. Renewal duration is pricing_interval.count multiplied by this value. Present alongside pricing_interval for unit_subscription products and plans with configured recurring terms; omitted otherwise.
Gerelateerde bronnen
Ga verder met de documentatie, handleidingen en voorbeelden voor dit onderwerp.