#awMerritt
1 messages · Page 1 of 1 (latest)
👋 I appreciate you!
Can you provide the example subscription or other object where you see this, and a failing retrieval request?
I only have API access to the account. Is there a way to find the failing retrieval request through the API?
Account id: acct_1IK3Q9Ip44qmNcCx,
Subscription id: sub_1N9S2CIp44qmNcCx9udwyzpk
subscriptions that have plan id's that are not retreivable
Can you explain what you mean by this then?
What does "not retrievable" mean if not an error when retrieving?
Ah, sure. I'm using stripe's ruby gem. Here's an example of the message:
[11] swarm@production:pry (main)> plan_id = Stripe::Subscription.retrieve(sub_id, {api_key: api_key}).plan.id
=> "plan-eWcH4-2VGJblDGDl"
[12] swarm@production:pry (main)> Stripe::Plan.retrieve(plan_id, {api_key: api_key})
Stripe::InvalidRequestError: No such plan: 'plan-eWcH4-2VGJblDGDl'
The plan information is being returned on the subscription object, but I can't retrieve the actual plan object.
https://dashboard.stripe.com/logs/req_SftgYV13rqDgg5
https://dashboard.stripe.com/logs/req_BfERqjPcWdlnrL
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
That subscription item should also have a price exposed
And you should be able to retrieve that
I'm sorry, I only have API access so I can't actually see those. I'm working on behalf of the account owner.
The subscription object being returned only has a plan, no price attribute.
The plan object on the subscription lists a product id, which also cannot be retrieved.
Stripe::InvalidRequestError: No such product: 'prod_MwIhIV1j3gCYoV'```
Sorry missed the follow up on this one
Hmm the product does seem to exist, so thats odd
The subscription object being returned only has a plan, no price attribute
This would be inside the individualitems
This would be inside the individual items
I see, that is returning the same id as the plan object, and is also not retrievable.
Stripe::InvalidRequestError: No such price: 'plan-eWcH4-2VGJblDGDl'```
Can you share the response payload from the subscription retrieval?
#<Stripe::Subscription:0x24568 id=sub_1N9S2CIp44qmNcCx9udwyzpk> JSON: {
"id": "sub_1N9S2CIp44qmNcCx9udwyzpk",
"object": "subscription",
"application": "ca_2NAd1OiIfDwX3U3FEvBrMniu7RE6U8wc",
"application_fee_percent": null,
"automatic_tax": {"enabled":false},
"billing_cycle_anchor": 1685102628,
"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": 1684497828,
"currency": "gbp",
"current_period_end": 1685102628,
"current_period_start": 1684497828,
"customer": "cus_NvIddEwzPRRYdx",
"days_until_due": null,
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [
],
"description": null,
"discount": null,
"ended_at": null,```
"latest_invoice": "in_1N9S2CIp44qmNcCxRdPbrMUk",
"livemode": true,
"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":"plan-eWcH4-2VGJblDGDl","object":"plan","active":false,"aggregate_usage":null,"amount":4799,"amount_decimal":"4799","billing_scheme":"per_unit","created":1670429047,"currency":"gbp","interval":"year","interval_count":1,"livemode":true,"metadata":{},"nickname":null,"product":"prod_MwIhIV1j3gCYoV","tiers_mode":null,"transform_usage":null,"trial_period_days":7,"usage_type":"licensed"},
"quantity": 1,
"schedule": null,
"start_date": 1684497828,
"status": "trialing",
"test_clock": null,
"transfer_data": null,
"trial_end": 1685102628,
"trial_settings": {"end_behavior":{"missing_payment_method":"create_invoice"}},
"trial_start": 1684497828
}```
Sorry had to break it up because of character limits for discord.
Yep thanks, np
Ahh i missed that the product has been deleted
And the price has been archived
Oh no... Is there any way to restore?
That seems kind of odd that you can have an active subscription on a deleted product
Well the price was archived, but still exists. Just no longer active. Deleted is similar for product, cannot be used for anything new, but still exists for being tied to those existing plans/prices.
Ok I think I found a work-around here. I can re-create the Plan objects with the archived/deleted plan id, do my work, and then re-delete all of them. Not ideal, but... it works.
Great if that works for you, but to be honest I'm a little surprised it does. It shouldn't be possible to create a plan or price with a deleted product.
It shouldn't be possible
This is my world. I appreciate the help. It would be really nice to have a way to list all prices/products, including deleted, similar to howsubscriptions can be retreived with thestatus: "all"flag.
I'm logging out now, thanks you so much!
If there's any kind of "satisfaction survey" or anything I can take, feel free to email it to me. andrew.merritt@beehiiv.com
You guys do an amazing job.
Quite welcome, good luck with the rest of your work