#guccisofloppy
1 messages ยท Page 1 of 1 (latest)
Is it possible you're making a request with an old API version?
Can you share the request ID here?
quantity should be within some items entry
(subscription items)
let me go through the logs to get you a request ID
FWIW, subscription.id starts with sub_ and the object type is "subscription"
req_uqmZHtCuxpGP04
Ok thanks -- looks not that old, 2020-08-27
Can you share the subscriptions data in teh response payload?
but, taking a step back, i agree this sounds like typescript and you might need to ignore that line or provide the type as a subscription
yeah, this integration was stood up very quickly, I think the previous dev made some assumptions about the shape of data Stripe was returning...
id: 'sub_1NDTq3AKr8gWA65Au9m77x7Z',
object: 'subscription',
application: null,
application_fee_percent: null,
automatic_tax: { enabled: false },
billing_cycle_anchor: 1685995887,
billing_thresholds: null,
cancel_at: null,
cancel_at_period_end: false,
canceled_at: null,
cancellation_details: { comment: null, feedback: null, reason: null },
collection_method: 'charge_automatically',
created: 1685458075,
currency: 'usd',
current_period_end: 1717618287,
current_period_start: 1685995887,
customer: 'cus_Np3SY9tRm0Bp6c',
days_until_due: null,
default_payment_method: null,
default_source: null,
default_tax_rates: [],
description: null,
discount: null,
ended_at: null,
items: {
object: 'list',
data: [ [Object] ],
has_more: false,
total_count: 1,
url: '/v1/subscription_items?subscription=sub_1NDTq3AKr8gWA65Au9m77x7Z'
},
latest_invoice: 'in_1NFjkRAKr8gWA65Ap2ikBmV6',
livemode: false,
metadata: {},
next_pending_invoice_item_invoice: null,
on_behalf_of: null,
pause_collection: null,
payment_settings: {
payment_method_options: null,
payment_method_types: null,
save_default_payment_method: 'off'
},
pending_invoice_item_interval: null,
pending_setup_intent: null,
pending_update: null,
plan: {
id: 'price_1NDTjnAKr8gWA65AFZFv3F9q',
object: 'plan',
active: true,
aggregate_usage: null,
amount: null,
amount_decimal: null,
billing_scheme: 'tiered',
created: 1685457687,
currency: 'usd',
interval: 'year',
interval_count: 1,
livemode: false,
metadata: {},
nickname: 'Yearly',
product: 'prod_NzSfVZrKl6ssVk',
...
},
quantity: 7,
schedule: null,
start_date: 1685458075,
status: 'active',
test_clock: null,
transfer_data: null,
trial_end: null,
trial_settings: { end_behavior: { missing_payment_method: 'create_invoice' } },
trial_start: null
}```
posted the payload here
omitted some of the price data
if I wasn't worried about it breaking everything, I would just change the query inside of the method this is returning from, I'd prefer to have this fit a bit more "to spec"
I think this is a case of needing to tell your TS linter to ignore that extra data
Oh, so the issue I was hitting is that the type being returned from the function is Stripe.Subscription, but TS is confused because Stripe.Subscription doesn't have values like quantity. There are a slew of ways to fix this inside of TS, but I was hoping to change the return value to something more accurate
๐ hopping in here since synthrider has to head out - give me a minute to catch up
๐
Sorry for the wait - so yeah after catching up here, I think this is something that happens fairly often w/ deprecated properties on our API. When we deprecate properties we'll remove them from the TS type, but our API will still continue returning them (because others may still rely on them and we don't want to break them)