#naughty developer
1 messages · Page 1 of 1 (latest)
Hi,
Could you please share more details ?
hey osam , naughty dev here haha , my question is
i have different products , some have standard pricing and some have volume pricing
before i used to create or update a subscription
and had to store unit price to show customer
for standard pricing it was ok
but for volume pricing i'm getting null in all unit_amount in subscription object
{
"id": "sub_1MVua3IfyyzwPELM7aWfydcu",
"object": "subscription",
"items": {
"object": "list",
"data": [
{
"id": "si_NGRSMuRFj9xRVQ",
"object": "subscription_item",
"billing_thresholds": null,
"created": 1675074439,
"metadata": [
],
"plan": {
"id": "price_1MUqL1IfyyzwPELM5vdzWyRb",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": null,
"amount_decimal": null,
"billing_scheme": "tiered",
"created": 1674819803,
"currency": "usd",
"interval": "year",
"interval_count": 1,
"livemode": false,
"metadata": [
],
"nickname": null,
"product": "prod_LZuk3OoVnNTkn3",
"tiers_mode": "volume",
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
},
"price": {
"id": "price_1MUqL1IfyyzwPELM5vdzWyRb",
"object": "price",
"active": true,
"billing_scheme": "tiered",
"created": 1674819803,
"currency": "usd",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": [
],
"nickname": null,
"product": "prod_LZuk3OoVnNTkn3",
"recurring": {
"aggregate_usage": null,
"interval": "year",
"interval_count": 1,
"trial_period_days": null,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": "volume",
"transform_quantity": null,
"type": "recurring",
"unit_amount": null,
"unit_amount_decimal": null
},
"quantity": 1,
"subscription": "sub_1MVua3IfyyzwPELM7aWfydcu",
"tax_rates": [
]
}
],
}
this is an example object
for standard product prices
i can just do plan["amount"] and get unit amount
but for product with volume pricing
i cannot get any kind of amount in whole of object
hope u understand my question
If I understand well your question, you need to retrieve the price object by Id,
https://stripe.com/docs/api/prices/retrieve or you expand the price field on Susbcription when fetching it:
https://stripe.com/docs/api/expanding_objects
is there no way to get the exact unit amount im being charged
my invoice is showing 1 × PlayBookAI (Tier 1 at $299.00 / month)
my price range is
1-5 299$
6-10 289$
i want to get the exact one instead of calculating myself with the price apis
because i want the exact unit price being charged inside the subscription
You can find this information, in the Invoice instead, you can refer to the latest invoice of the Subscription or for a billing period and fetch the amounts used by the customer