#Tiana-price

1 messages · Page 1 of 1 (latest)

torpid veldt
#

@lapis nymph hi! can you clarify a little? Where do your customers generally see the price?

lapis nymph
#

Stripe Billing

torpid veldt
lapis nymph
#

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.

torpid veldt
lapis nymph
#

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

torpid veldt
#

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

lapis nymph
#

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

torpid veldt
#

you just have to list all Prices and then filter by metadata in your local code(or store the IDs in your database locally)

lapis nymph
#

That doesn't sounds optimal.

torpid veldt
#

yep but it's the only option I'm aware of

lapis nymph
#

Fetching prices always return an empty metadata object ?

torpid veldt
#

it shouldn't

lapis nymph
#

Yet it does.
Price ID : price_1Jbie6LbsLLKOO0eJXyf1pPP

#

Request ID : req_Q0fiH7PXHPOcZB

torpid veldt
#

there's no metadata on that Price so that's normal

lapis nymph
torpid veldt
#

on the page for the Price

#

you just added some I see

lapis nymph
#

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 ?

torpid veldt
#

I mainly answer API questions so I don't know much about how the dashboard works

lapis nymph
#

Here's how I tried req_PKL568ZwTndf38

torpid veldt
#

because that makes it much more difficult to format complex parameters which is the problem you're having now

lapis nymph
#

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 ?

torpid veldt
#

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)

lapis nymph
#

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 ?

torpid veldt
#

it's just not a priority

lapis nymph
#

But how was x-www-form-urlencoded chosen in the first place ?

torpid veldt
#

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

lapis nymph
#

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"
torpid veldt
#

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

lapis nymph
#

So I'm going to generate one everytime ?

#

Missing required param: business_profile
Never heard of that

lapis nymph
#

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

lapis nymph
#

Why would a newly added product & price not be available on the customer portal with default settings ?

torpid veldt
#

I'm not sure! Would need a lot more detail than that.

lapis nymph
#

Product ID : prod_KEPimylHFUP312

#

Price IDs : price_1JZxB8LbsLLKOO0e7taKGyVW, price_1JZxAkLbsLLKOO0eXXVrZydl, price_1JZwt5LbsLLKOO0edcHeImee, price_1JZwt5LbsLLKOO0eKirmIov2

torpid veldt