#Tiana-price
1 messages · Page 1 of 1 (latest)
@lapis nymph hi! can you clarify a little? Where do your customers generally see the price?
Stripe Billing
can you clarify a little? Do you use the customer portal? https://stripe.com/docs/billing/subscriptions/customer-portal
Yes.
I need to display to the customer a plan that only that one has access to, which contains specific features that were manually negociated with sales.
you can create and pass a specific configuration ad-hoc to the portal session : https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#customize so e.g. you could use https://stripe.com/docs/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-products to control what products will show in that portal session
I'll look into that, thanks !
@torpid veldt That won't work with archived prices.
I need the price to be disabled for everyone but a single customer
then you just don't archive the price and instead only create configurations that allow that price when you're working with that customer, and for everyone else create configurations that exclude it
Then I will need to add metadata to prices that are allowed only for a specific customer, and only return those to the customer portal when there are some, otherwise return all other prices that are allowed to everyone.
So, how can I get prices that have specific metadata ?
Thanks
you just have to list all Prices and then filter by metadata in your local code(or store the IDs in your database locally)
That doesn't sounds optimal.
yep but it's the only option I'm aware of
Fetching prices always return an empty metadata object ?
it shouldn't
Yet it does.
Price ID : price_1Jbie6LbsLLKOO0eJXyf1pPP
Request ID : req_Q0fiH7PXHPOcZB
there's no metadata on that Price so that's normal
there's metadata on the Product https://dashboard.stripe.com/test/products/prod_KGF8lFssmf8pWa
so in an API request you'd pass expand:["data.product"] (https://stripe.com/docs/expand#lists) and then you can look at prices.data[i].product.metadata for example
Where in dashboard.stripe.com can you add metadata on the price ?
Yes actually I didn't, my boss did, and he didn't found out where to do that at first, when clicking on the price the UI would open a modal that doesn't have metadata fields, apparently he had to click on the product to edit the price metadata ?
I mainly answer API questions so I don't know much about how the dashboard works
How does that work as an HTTP request ?
What would be the value of features[subscription_update][products] ?
Here's how I tried req_PKL568ZwTndf38
can I ask why you're using axios and not one of our official backend libraries ? https://stripe.com/docs/libraries
because that makes it much more difficult to format complex parameters which is the problem you're having now
Because I didn't foresee this complexity. I always use axios for external APIs which usually work with JSON request bodies. Additionally, the less dependencies we have, the better, as we're running on AWS Lambda
We currently depend on a dozen of external APIs and we wouldn't want to have a dozen dependencies.
So how do I perform this request ?
if it helps here's an example
const configuration = await stripe.billingPortal.configurations.create({
features: {
payment_method_update: {enabled:true},
subscription_update: {
default_allowed_updates: ['price'],
enabled: true,
products : [
{
product: "prod_KFCYxpuOq3fJkT",
prices: ["plan_KFCYdyYJ5ojjZe"]
},
{
product: "prod_JXffY4q8HrpAN3",
prices: ["price_1J8kb1JoUivz182D5VsKmQUZ", "price_1JbjRXJoUivz182Dr0DtwP0c"]
},
]
},
},
business_profile: {
privacy_policy_url: 'https://example.com/privacy',
terms_of_service_url: 'https://example.com/terms',
},
});
can get the raw POST data too, one sec
I understand your point about dependencies but disagree
the raw post data looks like this so you'd need to figure out how to use Axios to send it
features[payment_method_update][enabled]=true&features[subscription_update][default_allowed_updates][0]=price&features[subscription_update][enabled]=true&features[subscription_update][products][0][product]=prod_KFCYxpuOq3fJkT&features[subscription_update][products][0][prices][0]=plan_KFCYdyYJ5ojjZe&features[subscription_update][products][1][product]=prod_JXffY4q8HrpAN3&features[subscription_update][products][1][prices][0]=price_1J8kb1JoUivz182D5VsKmQUZ&features[subscription_update][products][1][prices][1]=price_1JbjRXJoUivz182Dr0DtwP0c&business_profile[privacy_policy_url]=https%3A%2F%2Fexample.com%2Fprivacy&business_profile[terms_of_service_url]=https%3A%2F%2Fexample.com%2Fterms
also note our API does not take JSON. It takes 'x-www-form-urlencoded' data (we do think about potentially supporting JSON since it comes up a lot, but as of today our answer is you should use or official libraries which let you pass things in an idiomatic way for the language being used)
also note our API does not take JSON
I know, I never foreseen that either.
we do think about potentially supporting JSON since it comes up a lot
Thanks for considering it.
the raw post data looks like this so you'd need to figure out how to use Axios to send it
I can do that, thanks.
What back-end do you have ?
Is x-www-form-urlencoded a constraint due to that back-end ?
it's just not a priority
But how was x-www-form-urlencoded chosen in the first place ?
probably what was picked when Stripe started around 2011, and as I said, it's not a priority to revisit
we think about it often and I've been in the discussions, but we look at the data and the vast majority of traffic is from official libraries that abstract this level of detail anyway so it's not something a case can be made for usually given other priorities. Our position is the encoding doesn't matter, you use our libraries and they present things in an idiomatic way for the language you're using
I'm getting an HTTP 400 response, here's my request ID : req_av4CvZUJLP09Tl
The params should be okay this time
"features[subscription_update][products][0][prices][0]": "price_1Jbie6LbsLLKOO0eJXyf1pPP",
"features[subscription_update][products][0][product]": "prod_KGF8lFssmf8pWa"
can you try sending the data as POST data instead of URL query parameters? That's my best guess as to why that might not work
it shouldn't matter but sometimes it does
unfortunately I have to run to a meeting sorry, and there's no one else online in my team right now, but I'll try to revisit in an hour
oh wait
you're calling /v1/billing_portal/sessions
it should be /v1/billing_portal/configuration
it's https://stripe.com/docs/api/customer_portal/configurations/create first, and then you pass the config to a session later https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-configuration
So I'm going to generate one everytime ?
Missing required param: business_profile
Never heard of that
Now I'm getting this : Cannot enable subscription updates while disabling payment method update
Even after providing all three possible enum values combined.
I never wanted to disable payment method update
Oh I see, everything is disabled by default
Why would a newly added product & price not be available on the customer portal with default settings ?
I'm not sure! Would need a lot more detail than that.
for example maybe it's a metered price(those are not supported https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#limitations)
Product ID : prod_KEPimylHFUP312
Price IDs : price_1JZxB8LbsLLKOO0e7taKGyVW, price_1JZxAkLbsLLKOO0eXXVrZydl, price_1JZwt5LbsLLKOO0edcHeImee, price_1JZwt5LbsLLKOO0eKirmIov2
it's not added to your default configuration at https://dashboard.stripe.com/test/settings/billing/portal